From 9619c8c37e231e4c4777f80636961eb09c1a6fed Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 10 Apr 2023 10:29:26 +0800 Subject: [PATCH] style: remove Space font style (#40326) * refactor: simplify code * style: fix Space font style * demo: fix Select demo --- components/space/style/index.tsx | 20 +++++++++++-------- .../theme/util/genComponentStyleHook.ts | 8 +++++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/components/space/style/index.tsx b/components/space/style/index.tsx index 7ebfc0b570..a83d8da914 100644 --- a/components/space/style/index.tsx +++ b/components/space/style/index.tsx @@ -38,17 +38,21 @@ const genSpaceStyle: GenerateStyle = (token) => { alignItems: 'baseline', }, }, - [`${componentCls}-item`]: { - '&:empty': { - display: 'none', - }, + [`${componentCls}-item:empty`]: { + display: 'none', }, }, }; }; // ============================== Export ============================== -export default genComponentStyleHook('Space', (token) => [ - genSpaceStyle(token), - genSpaceCompactStyle(token), -]); +export default genComponentStyleHook( + 'Space', + (token) => [genSpaceStyle(token), genSpaceCompactStyle(token)], + () => ({}), + { + // Space component don't apply extra font style + // https://github.com/ant-design/ant-design/issues/40315 + resetStyle: false, + }, +); diff --git a/components/theme/util/genComponentStyleHook.ts b/components/theme/util/genComponentStyleHook.ts index eafea9527d..e3f2666297 100644 --- a/components/theme/util/genComponentStyleHook.ts +++ b/components/theme/util/genComponentStyleHook.ts @@ -41,6 +41,9 @@ export default function genComponentStyleHook OverrideTokenWithoutDerivative[ComponentName]), + options?: { + resetStyle?: boolean; + }, ) { return (prefixCls: string): UseComponentStyleResult => { const [theme, token, hashId] = useToken(); @@ -93,7 +96,10 @@ export default function genComponentStyleHook