<template>
  <div>
    <div class="header-box bg-white dark:bg-dark-900">
      <DesignLogo />
      <div class="header-title">{{ title }}</div>

      <div class="button-box">
        <slot name="buttons"></slot>
      </div>
    </div>
    <div class="step-box bg-white dark:bg-dark-900" v-if="hasStepsSlot"
      ><slot name="steps"></slot
    ></div>
  </div>
</template>

<script setup lang="ts">
  import { computed, useSlots } from 'vue';
  import { DesignLogo } from '/@/components/ModalPanel/index';
  withDefaults(
    defineProps<{
      title: string;
    }>(),
    {
      title: '',
    },
  );
  const hasStepsSlot = computed(() => {
    return !!useSlots().steps;
  });
</script>

<style lang="less" scoped>
  @keyframes rotation {
    from {
      transform: rotate(0deg);
    }

    to {
      transform: rotate(360deg);
    }
  }
  @keyframes rotationReverse {
    from {
      transform: rotate(0deg);
    }

    to {
      transform: rotate(-360deg);
    }
  }

  .header-box {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    position: relative;
  }

  // .box-shadow {
  //   box-shadow: 5px 5px 5px rgb(0 0 0 / 10%);
  // }

  .left {
    display: flex;
    align-items: center;
  }

  .header-title {
    position: absolute;
    left: 0;
    right: 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    text-align: center;
  }

  [data-theme='dark'] .header-title {
    color: #fff;
  }

  .step-box {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;
    margin: 10px;
    border-radius: 16px;

    :deep(.ant-steps) {
      .ant-steps-item-icon {
        margin-right: 16px;
        width: 37px;
        height: 37px;
        line-height: 37px;

        .ant-steps-icon {
          font-size: 18px;
          font-weight: bold;
        }
      }

      .ant-steps-item-container {
        height: 44px;
        padding-top: 4px;
        padding-left: 5px;
      }

      .ant-steps-item-process {
        .ant-steps-item-icon {
          border: 3px solid #fff;
          animation: rotation 4s linear infinite;
          position: relative;

          &::before {
            border: 2px dashed #1890ff;
            content: '';
            width: 44px;
            height: 44px;
            display: block;
            border-radius: 50%;
            position: absolute;
            left: -6px;
            top: -6px;
          }

          .ant-steps-icon {
            display: inline-block;
            animation: rotationReverse 4s linear infinite;
            line-height: 32px;
            inset: 0;
            position: absolute;
          }
        }
      }

      .ant-steps-item-wait {
        .ant-steps-item-icon {
          background-color: #f0f0f0;
          border-color: #f0f0f0;

          .ant-steps-icon {
            color: #cacaca;
          }
        }
      }

      .ant-steps-item-finish .ant-steps-item-icon {
        background-color: #eaf4ff;
        border-color: #eaf4ff;
      }

      .ant-steps-item-title::after {
        background-color: #eee;
      }
    }
  }

  .button-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
</style>
