<template>
  <view class="construction-frame">
    <slot>
      <view class="construction-inner">
        <FlexCol center :gap="16" :padding="[40, 32]">
          <Icon icon="warning-filling" :size="56" color="#f5c518" />
          <Text :text="title" fontConfig="title" textAlign="center" bold />
          <Text :text="text" fontConfig="subText" textAlign="center" color="text.second" />
          <slot />
        </FlexCol>
      </view>
    </slot>
    <view v-if="$slots.default" class="construction-float">
      <Icon icon="warning-filling" :size="34" color="#f5c518" />
      <Text :text="text" fontConfig="subText" textAlign="center" color="text.second" />
    </view>
  </view>
</template>

<script setup lang="ts">
import Icon from '@/components/basic/Icon.vue';
import Text from '@/components/basic/Text.vue';
import FlexCol from '@/components/layout/FlexCol.vue';

withDefaults(defineProps<{
  /** 说明文字 */
  text?: string;
  /** 标题 */
  title?: string;
}>(), {
  text: '此功能正在开发中，敬请期待',
  title: '开发建设中',
});
</script>

<style lang="scss" scoped>
.construction-frame {
  position: relative;
  padding: 10rpx;
  border-radius: 20rpx;
  background-color: #f5c518;
  background-image: repeating-linear-gradient(
    -45deg,
    #1a1a1a 0,
    #1a1a1a 18rpx,
    #f5c518 18rpx,
    #f5c518 36rpx
  );
  box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
}

.construction-float {
  position: absolute;
  top: -25rpx;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fff;
  padding: 10rpx;
  border-radius: 10rpx;
  box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10rpx;
}

.construction-inner {
  border-radius: 14rpx;
  background: #fff;
  overflow: hidden;
}
</style>
