next/components/icon.vue

34 lines
709 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="{
...$attrs.style,
fontSize: pixi,
2023-10-11 16:40:30 -04:00
color: icolor || 'currentcolor',
}"
:class="`fa${styleMap[istyle]} fa-${name}`"
/>
</template>