style: remove Space font style (#40326)

* refactor: simplify code

* style: fix Space font style

* demo: fix Select demo
pull/41723/head
afc163 2 years ago committed by GitHub
parent 862ce2eba5
commit 9619c8c37e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,17 +38,21 @@ const genSpaceStyle: GenerateStyle<SpaceToken> = (token) => {
alignItems: 'baseline', alignItems: 'baseline',
}, },
}, },
[`${componentCls}-item`]: { [`${componentCls}-item:empty`]: {
'&:empty': {
display: 'none', display: 'none',
}, },
}, },
},
}; };
}; };
// ============================== Export ============================== // ============================== Export ==============================
export default genComponentStyleHook('Space', (token) => [ export default genComponentStyleHook(
genSpaceStyle(token), 'Space',
genSpaceCompactStyle(token), (token) => [genSpaceStyle(token), genSpaceCompactStyle(token)],
]); () => ({}),
{
// Space component don't apply extra font style
// https://github.com/ant-design/ant-design/issues/40315
resetStyle: false,
},
);

@ -41,6 +41,9 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp
getDefaultToken?: getDefaultToken?:
| OverrideTokenWithoutDerivative[ComponentName] | OverrideTokenWithoutDerivative[ComponentName]
| ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName]), | ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName]),
options?: {
resetStyle?: boolean;
},
) { ) {
return (prefixCls: string): UseComponentStyleResult => { return (prefixCls: string): UseComponentStyleResult => {
const [theme, token, hashId] = useToken(); const [theme, token, hashId] = useToken();
@ -93,7 +96,10 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp
overrideComponentToken: token[component], overrideComponentToken: token[component],
}); });
flush(component, mergedComponentToken); flush(component, mergedComponentToken);
return [genCommonStyle(token, prefixCls), styleInterpolation]; return [
options?.resetStyle === false ? null : genCommonStyle(token, prefixCls),
styleInterpolation,
];
}), }),
hashId, hashId,
]; ];

Loading…
Cancel
Save