Skip to content

Commit f50a8e6

Browse files
authored
chore: remove warning of cssinjs in Space.Compact (#52489)
1 parent 5f9bbb8 commit f50a8e6

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

components/button/style/compact.ts

+14-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,20 @@ import { prepareComponentToken, prepareToken } from './token';
1111
const genButtonCompactStyle: GenerateStyle<ButtonToken> = (token) => {
1212
const { componentCls, colorPrimaryHover, lineWidth, calc } = token;
1313
const insetOffset = calc(lineWidth).mul(-1).equal();
14-
const getCompactBorderStyle = (vertical?: boolean) =>
15-
({
16-
[`${componentCls}-compact${vertical ? '-vertical' : ''}-item${componentCls}-primary:not([disabled])`]:
17-
{
18-
'& + &::before': {
19-
position: 'absolute',
20-
top: vertical ? insetOffset : 0,
21-
insetInlineStart: vertical ? 0 : insetOffset,
22-
backgroundColor: colorPrimaryHover,
23-
content: '""',
24-
width: vertical ? '100%' : lineWidth,
25-
height: vertical ? lineWidth : '100%',
26-
},
27-
},
28-
}) as CSSObject;
14+
const getCompactBorderStyle = (vertical?: boolean) => {
15+
const selector = `${componentCls}-compact${vertical ? '-vertical' : ''}-item${componentCls}-primary:not([disabled])`;
16+
return {
17+
[`${selector} + ${selector}::before`]: {
18+
position: 'absolute',
19+
top: vertical ? insetOffset : 0,
20+
insetInlineStart: vertical ? 0 : insetOffset,
21+
backgroundColor: colorPrimaryHover,
22+
content: '""',
23+
width: vertical ? '100%' : lineWidth,
24+
height: vertical ? lineWidth : '100%',
25+
} as CSSObject,
26+
};
27+
};
2928
// Special styles for Primary Button
3029
return {
3130
...getCompactBorderStyle(),

0 commit comments

Comments
 (0)