mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: simplify style requirement
This commit is contained in:
parent
912ffb15d0
commit
4aac9f7522
@ -86,7 +86,6 @@ export const DesignTokenContext = React.createContext<{
|
||||
|
||||
// ================================== Hook ==================================
|
||||
export function useToken() {
|
||||
const { iconPrefixCls } = React.useContext(ConfigContext);
|
||||
const { token: rootDesignToken, hashed } = React.useContext(DesignTokenContext);
|
||||
const theme = React.useContext(ThemeContext);
|
||||
|
||||
@ -95,7 +94,7 @@ export function useToken() {
|
||||
const [token, hashId] = useCacheToken(theme, [defaultDesignToken, rootDesignToken], {
|
||||
salt,
|
||||
});
|
||||
return [theme, token, iconPrefixCls, hashed ? hashId : ''];
|
||||
return [theme, token, hashed ? hashId : ''];
|
||||
}
|
||||
|
||||
// ================================== Util ==================================
|
||||
|
@ -154,11 +154,12 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
const { getPrefixCls, autoInsertSpaceInButton, direction } = React.useContext(ConfigContext);
|
||||
const { getPrefixCls, autoInsertSpaceInButton, direction, iconPrefixCls } =
|
||||
React.useContext(ConfigContext);
|
||||
const prefixCls = getPrefixCls('btn', customizePrefixCls);
|
||||
|
||||
// Style
|
||||
const wrapSSR = useStyle(prefixCls);
|
||||
const wrapSSR = useStyle(prefixCls, iconPrefixCls);
|
||||
|
||||
const size = React.useContext(SizeContext);
|
||||
const [innerLoading, setLoading] = React.useState<Loading>(!!loading);
|
||||
|
@ -373,8 +373,8 @@ const genSizeLargeButtonStyle = (
|
||||
};
|
||||
|
||||
// ============================== Export ==============================
|
||||
export default function useStyle(prefixCls: string) {
|
||||
const [theme, token, iconPrefixCls, hashId] = useToken();
|
||||
export default function useStyle(prefixCls: string, iconPrefixCls: string) {
|
||||
const [theme, token, hashId] = useToken();
|
||||
|
||||
return useStyleRegister({ theme, token, hashId, path: [prefixCls] }, () => [
|
||||
// Shared
|
||||
|
@ -25,7 +25,7 @@ export interface ConfigConsumerProps {
|
||||
getTargetContainer?: () => HTMLElement;
|
||||
getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
|
||||
rootPrefixCls?: string;
|
||||
iconPrefixCls?: string;
|
||||
iconPrefixCls: string;
|
||||
getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
|
||||
renderEmpty: RenderEmptyHandler;
|
||||
csp?: CSPConfig;
|
||||
|
Loading…
Reference in New Issue
Block a user