diff --git a/components/space/Compact.tsx b/components/space/Compact.tsx index b3560a71c1..063b7a8868 100644 --- a/components/space/Compact.tsx +++ b/components/space/Compact.tsx @@ -8,6 +8,7 @@ import type { SizeType } from '../config-provider/SizeContext'; import useSize from '../config-provider/hooks/useSize'; import useStyle from './style'; +import useCSSVar from './style/cssVar'; export interface SpaceCompactItemContextType { compactSize?: SizeType; @@ -80,7 +81,8 @@ const Compact: React.FC = (props) => { const mergedSize = useSize((ctx) => size ?? ctx); const prefixCls = getPrefixCls('space-compact', customizePrefixCls); - const [wrapSSR, hashId] = useStyle(prefixCls); + const [, hashId] = useStyle(prefixCls); + const wrapCSSVar = useCSSVar(prefixCls); const clx = classNames( prefixCls, hashId, @@ -122,7 +124,7 @@ const Compact: React.FC = (props) => { return null; } - return wrapSSR( + return wrapCSSVar(
{nodes}
, diff --git a/components/space/index.tsx b/components/space/index.tsx index af596a001a..a6c3aeb9d9 100644 --- a/components/space/index.tsx +++ b/components/space/index.tsx @@ -10,6 +10,7 @@ import { SpaceContextProvider } from './context'; import type { SpaceContextType } from './context'; import Item from './Item'; import useStyle from './style'; +import useCSSVar from './style/cssVar'; export { SpaceContext } from './context'; @@ -63,7 +64,8 @@ const Space = React.forwardRef((props, ref) => { const mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align; const prefixCls = getPrefixCls('space', customizePrefixCls); - const [wrapSSR, hashId] = useStyle(prefixCls); + const [, hashId] = useStyle(prefixCls); + const wrapCSSVar = useCSSVar(prefixCls); const cls = classNames( prefixCls, @@ -128,7 +130,7 @@ const Space = React.forwardRef((props, ref) => { gapStyle.rowGap = verticalSize; } - return wrapSSR( + return wrapCSSVar(
= (token) => { }; // ============================== Export ============================== +export const prepareComponentToken: GetDefaultToken<'Space'> = () => ({}); + export default genComponentStyleHook( 'Space', (token) => {