<script setup lang="ts">
import { IconXSolid } from '@computing/opendesign-icons';
</script>

<template>
  <span class="icon-x-solid-box">
    <!-- 该图标中间的x是透明的，在表单校验失败时，会展示背景浅红色，用一个白色辅助盒子把x后面部分遮住，这样x看起来就是白色的 -->
    <span class="auxiliary-box"></span>
    <IconXSolid class="icon-x-solid" />
  </span>
</template>

<style lang="scss" scoped>
.icon-x-solid-box {
  border-radius: 50%;
  display: inline-block;
  width: 16px;
  height: 16px;
  position: relative;
  pointer-events: none;
  opacity: 0;

  .auxiliary-box {
    position: absolute;
    z-index: 1;
    left: 2px;
    top: 2px;
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border-radius: 50%;
  }

  :deep(.icon-x-solid) {
    position: absolute;
    z-index: 2;
    left: 0;
    top: 0;
    font-size: 16px;
    color: rgba(141,152,170,1);
  }
}
</style>
