From f829e401109b37b304a4aef3d49ccb96bd652160 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Tue, 21 Mar 2023 13:02:27 +0800 Subject: [PATCH] feat: Tag support borderless (#41305) * feat: Tag support borderless * update demo * update colorFillSecondary * update color * fix * update demo size --- components/tag/CheckableTag.tsx | 17 +- .../__snapshots__/demo-extend.test.ts.snap | 420 ++++++++++++++++++ .../__tests__/__snapshots__/demo.test.ts.snap | 420 ++++++++++++++++++ components/tag/demo/basic.tsx | 2 +- components/tag/demo/borderless.md | 7 + components/tag/demo/borderless.tsx | 55 +++ components/tag/demo/borderlessLayout.md | 7 + components/tag/demo/borderlessLayout.tsx | 58 +++ components/tag/index.en-US.md | 3 + components/tag/index.tsx | 27 +- components/tag/index.zh-CN.md | 3 + components/tag/style/index.ts | 16 +- 12 files changed, 1010 insertions(+), 25 deletions(-) create mode 100644 components/tag/demo/borderless.md create mode 100644 components/tag/demo/borderless.tsx create mode 100644 components/tag/demo/borderlessLayout.md create mode 100644 components/tag/demo/borderlessLayout.tsx diff --git a/components/tag/CheckableTag.tsx b/components/tag/CheckableTag.tsx index 516074ec4d..b806786c65 100644 --- a/components/tag/CheckableTag.tsx +++ b/components/tag/CheckableTag.tsx @@ -18,14 +18,15 @@ export interface CheckableTagProps { onClick?: (e: React.MouseEvent) => void; } -const CheckableTag: React.FC = ({ - prefixCls: customizePrefixCls, - className, - checked, - onChange, - onClick, - ...restProps -}) => { +const CheckableTag: React.FC = (props) => { + const { + prefixCls: customizePrefixCls, + className, + checked, + onChange, + onClick, + ...restProps + } = props; const { getPrefixCls } = React.useContext(ConfigContext); const handleClick = (e: React.MouseEvent) => { diff --git a/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap index d0ba406dc0..677ef14d73 100644 --- a/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/tag/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -221,6 +221,426 @@ exports[`renders components/tag/demo/basic.tsx extend context correctly 1`] = ` `; +exports[`renders components/tag/demo/borderless.tsx extend context correctly 1`] = ` +Array [ +
+
+ + Tag 1 + +
+
+ + Tag 2 + +
+
+ + Tag 3 + + + + +
+
+ + Tag 4 + + + + +
+
, +