From f50a8e6175ebc75a99b45a2d87e8f6306e8a4e7c Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 20 Jan 2025 15:09:49 +0800 Subject: [PATCH] chore: remove warning of cssinjs in Space.Compact (#52489) --- components/button/style/compact.ts | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/components/button/style/compact.ts b/components/button/style/compact.ts index 8f17385011..e487144335 100644 --- a/components/button/style/compact.ts +++ b/components/button/style/compact.ts @@ -11,21 +11,20 @@ import { prepareComponentToken, prepareToken } from './token'; const genButtonCompactStyle: GenerateStyle = (token) => { const { componentCls, colorPrimaryHover, lineWidth, calc } = token; const insetOffset = calc(lineWidth).mul(-1).equal(); - const getCompactBorderStyle = (vertical?: boolean) => - ({ - [`${componentCls}-compact${vertical ? '-vertical' : ''}-item${componentCls}-primary:not([disabled])`]: - { - '& + &::before': { - position: 'absolute', - top: vertical ? insetOffset : 0, - insetInlineStart: vertical ? 0 : insetOffset, - backgroundColor: colorPrimaryHover, - content: '""', - width: vertical ? '100%' : lineWidth, - height: vertical ? lineWidth : '100%', - }, - }, - }) as CSSObject; + const getCompactBorderStyle = (vertical?: boolean) => { + const selector = `${componentCls}-compact${vertical ? '-vertical' : ''}-item${componentCls}-primary:not([disabled])`; + return { + [`${selector} + ${selector}::before`]: { + position: 'absolute', + top: vertical ? insetOffset : 0, + insetInlineStart: vertical ? 0 : insetOffset, + backgroundColor: colorPrimaryHover, + content: '""', + width: vertical ? '100%' : lineWidth, + height: vertical ? lineWidth : '100%', + } as CSSObject, + }; + }; // Special styles for Primary Button return { ...getCompactBorderStyle(),