antd-tiny-vue/components/config-provider/style/index.ts

24 lines
721 B
TypeScript
Raw Permalink Normal View History

2023-03-26 15:49:59 +08:00
import { useStyleRegister } from '@antd-tiny-vue/cssinjs'
import type { Ref } from 'vue'
import { computed } from 'vue'
import { resetIcon } from '../../style'
import { useToken } from '../../theme/internal'
const useStyle = (iconPrefixCls: Ref<string>) => {
const [theme, token] = useToken()
// Generate style for icons
const info = computed(() => ({ theme: theme.value, token: token.value, hashId: '', path: ['ant-design-icons', iconPrefixCls.value] }))
return useStyleRegister(info, () => [
{
[`.${iconPrefixCls.value}`]: {
...resetIcon(),
[`.${iconPrefixCls.value} .${iconPrefixCls.value}-icon`]: {
display: 'block'
}
}
}
])
}
export default useStyle