2023-08-28 10:49:18 +08:00
|
|
|
import { useStyleRegister } from '@ant-design/cssinjs';
|
2024-04-03 17:12:02 +08:00
|
|
|
|
2023-08-28 10:49:18 +08:00
|
|
|
import type { CSPConfig } from '../../config-provider';
|
2024-04-03 17:12:02 +08:00
|
|
|
import { resetIcon } from '../../style';
|
2023-08-28 10:49:18 +08:00
|
|
|
import useToken from '../useToken';
|
|
|
|
|
|
|
|
const useResetIconStyle = (iconPrefixCls: string, csp?: CSPConfig) => {
|
|
|
|
const [theme, token] = useToken();
|
|
|
|
|
|
|
|
// Generate style for icons
|
|
|
|
return useStyleRegister(
|
|
|
|
{
|
|
|
|
theme,
|
|
|
|
token,
|
|
|
|
hashId: '',
|
|
|
|
path: ['ant-design-icons', iconPrefixCls],
|
|
|
|
nonce: () => csp?.nonce!,
|
2024-04-03 17:12:02 +08:00
|
|
|
layer: {
|
|
|
|
name: 'antd',
|
|
|
|
},
|
2023-08-28 10:49:18 +08:00
|
|
|
},
|
|
|
|
() => [
|
|
|
|
{
|
|
|
|
[`.${iconPrefixCls}`]: {
|
|
|
|
...resetIcon(),
|
|
|
|
[`.${iconPrefixCls} .${iconPrefixCls}-icon`]: {
|
|
|
|
display: 'block',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default useResetIconStyle;
|