<!-- 剧游AI管理后台图标组件，统一封装第三方图标库的使用入口 -->

<script setup lang="ts">
import { computed } from "vue";
import * as Icons from "@element-plus/icons-vue";

type IconName = keyof typeof Icons;

interface Props {
  name: IconName;
  size?: number | string;
  color?: string;
}

const props = withDefaults(defineProps<Props>(), {
  size: 16,
});

const iconComponent = computed(() => Icons[props.name]);
</script>

<template>
  <el-icon
    :size="size"
    :color="color"
  >
    <component :is="iconComponent" />
  </el-icon>
</template>
