feat(projects): 1.0 beta

This commit is contained in:
Soybean
2023-11-17 08:45:00 +08:00
parent 1ea4817f6a
commit e918a2c0f5
499 changed files with 15918 additions and 24708 deletions

View File

@ -0,0 +1,56 @@
import { h } from 'vue';
import type { Component } from 'vue';
/**
* svg icon render hook
* @param SvgIcon svg icon component
*/
export default function useSvgIconRender(SvgIcon: Component) {
interface IconConfig {
/**
* iconify icon name
*/
icon?: string;
/**
* local icon name
*/
localIcon?: string;
/**
* icon color
*/
color?: string;
/**
* icon size
*/
fontSize?: number;
}
type IconStyle = Partial<Pick<CSSStyleDeclaration, 'color' | 'fontSize'>>;
/**
* svg icon VNode
* @param config
*/
const SvgIconVNode = (config: IconConfig) => {
const { color, fontSize, icon, localIcon } = config;
const style: IconStyle = {};
if (color) {
style.color = color;
}
if (fontSize) {
style.fontSize = `${fontSize}px`;
}
if (!icon && !localIcon) {
return undefined;
}
return () => h(SvgIcon, { icon, localIcon, style });
};
return {
SvgIconVNode
};
}