Skip to content

Commit 4a3e310

Browse files
authored
fix: space can not inherit attrs (#2902)
1 parent 5c8b779 commit 4a3e310

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Diff for: components/space/index.jsx

+13-7
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,24 @@ const Space = {
4949

5050
const mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align;
5151

52-
const someSpaceClass = {
53-
[prefixCls]: true,
54-
[`${prefixCls}-${direction}`]: true,
55-
// [`${prefixCls}-rtl`]: directionConfig === 'rtl',
56-
[`${prefixCls}-align-${mergedAlign}`]: mergedAlign,
57-
};
52+
const someSpaceClass = [
53+
{
54+
[prefixCls]: true,
55+
[`${prefixCls}-${direction}`]: true,
56+
// [`${prefixCls}-rtl`]: directionConfig === 'rtl',
57+
[`${prefixCls}-align-${mergedAlign}`]: mergedAlign,
58+
},
59+
];
60+
61+
if (content.data.class) {
62+
someSpaceClass.push(content.data.class);
63+
}
5864

5965
const itemClassName = `${prefixCls}-item`;
6066
const marginDirection = 'marginRight'; // directionConfig === 'rtl' ? 'marginLeft' : 'marginRight';
6167

6268
return (
63-
<div class={someSpaceClass}>
69+
<div {...content.data} class={someSpaceClass}>
6470
{items.map((child, i) => (
6571
<div
6672
class={itemClassName}

0 commit comments

Comments
 (0)