<script lang="ts" setup>
import { ref } from 'vue';

import { useVbenModal } from '@vben/common-ui';

import { InfoCircleOutlined } from '@ant-design/icons-vue';

const content = ref('');

const [Modal, modalApi] = useVbenModal({
  fullscreenButton: false,
  draggable: false,
  confirmText: '我知道了',
  onCancel() {
    modalApi.close();
  },
  onConfirm() {
    modalApi.close();
  },
  onOpenChange(isOpen: boolean) {
    if (isOpen) {
      const data = modalApi.getData<{
        content: string;
      }>();
      console.log('data', data);
      content.value = data.content || '';
    }
  },
});
</script>

<template>
  <Modal class="w-[500px]">
    <div class="info-modal-content">
      <div class="info-icon">
        <InfoCircleOutlined />
      </div>
      <div class="">{{ content }}</div>
    </div>
  </Modal>
</template>

<style scoped lang="less">
.info-modal-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;

  .info-icon {
    font-size: 24px;
    color: #1890ff;
    flex-shrink: 0;
    margin-top: 2px;
  }

  .info-text {
    flex: 1;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.85);
    word-break: break-word;
  }
}

:deep(.dark) {
  .info-text {
    color: rgba(255, 255, 255, 0.85);
  }
}
</style>
