Browse Source
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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
19 additions and
9 deletions
-
components/space/style/index.tsx
-
components/theme/util/genComponentStyleHook.ts
|
|
@ -38,17 +38,21 @@ const genSpaceStyle: GenerateStyle<SpaceToken> = (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, |
|
|
|
}, |
|
|
|
); |
|
|
|
|
|
@ -41,6 +41,9 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp |
|
|
|
getDefaultToken?: |
|
|
|
| OverrideTokenWithoutDerivative[ComponentName] |
|
|
|
| ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName]), |
|
|
|
options?: { |
|
|
|
resetStyle?: boolean; |
|
|
|
}, |
|
|
|
) { |
|
|
|
return (prefixCls: string): UseComponentStyleResult => { |
|
|
|
const [theme, token, hashId] = useToken(); |
|
|
@ -93,7 +96,10 @@ export default function genComponentStyleHook<ComponentName extends OverrideComp |
|
|
|
overrideComponentToken: token[component], |
|
|
|
}); |
|
|
|
flush(component, mergedComponentToken); |
|
|
|
return [genCommonStyle(token, prefixCls), styleInterpolation]; |
|
|
|
return [ |
|
|
|
options?.resetStyle === false ? null : genCommonStyle(token, prefixCls), |
|
|
|
styleInterpolation, |
|
|
|
]; |
|
|
|
}), |
|
|
|
hashId, |
|
|
|
]; |
|
|
|