next/components/icon.vue

33 lines
705 B
Vue
Raw Normal View History

2023-10-11 16:40:30 -04:00
<script lang="ts" setup>
import { theme } from "ant-design-vue";
const { useToken } = theme;
const { token } = useToken();
const col = token.value.colorText;
const propo = defineProps<{
name: string;
icolor?: string;
istyle: "regular" | "light" | "solid" | "thin";
size?: number;
proportionate?: boolean;
}>();
const propUnit = propo.proportionate ? "em" : "px";
const styleMap = {
regular: "r",
light: "l",
solid: "s",
thin: "t",
};
const pixi = propo.size ? `${propo.size}${propUnit}` : "inherit";
</script>
<template>
<i
:style="{
fontSize: `${size}${propUnit}`,
color: icolor || 'currentcolor',
}"
:class="`fa${styleMap[istyle]} fa-${name}`"
/>
</template>