From ef7b6e888bbe8e380c83d77f9f1891f02364e837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kiner-tang=28=E6=96=87=E8=BE=89=29?= <1127031143@qq.com> Date: Fri, 14 Jul 2023 17:05:59 +0800 Subject: [PATCH] fix: resolve ghost button lose disabled state when use type='ghost' (#43558) --- .../alert/__tests__/__snapshots__/demo-extend.test.ts.snap | 4 ++-- components/alert/__tests__/__snapshots__/demo.test.ts.snap | 4 ++-- components/alert/demo/action.tsx | 4 ++-- components/button/index.en-US.md | 2 +- components/button/index.zh-CN.md | 2 +- components/button/style/index.ts | 7 +++++++ 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap index b172abd57f..6dbefa9131 100644 --- a/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/alert/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -165,7 +165,7 @@ exports[`renders components/alert/demo/action.tsx extend context correctly 1`] = class="ant-space-item" > @@ -46,7 +46,7 @@ const App: React.FC = () => ( - diff --git a/components/button/index.en-US.md b/components/button/index.en-US.md index 170ba9abd4..85c9385c6d 100644 --- a/components/button/index.en-US.md +++ b/components/button/index.en-US.md @@ -67,7 +67,7 @@ Different button styles can be generated by setting Button properties. The recom | size | Set the size of button | `large` \| `middle` \| `small` | `middle` | | | styles | Semantic DOM style | Record | - | 5.4.0 | | target | Same as target attribute of a, works when href is specified | string | - | | -| type | Can be set to `primary` `ghost` `dashed` `link` `text` `default` | string | `default` | | +| type | Set button type | `primary` \| `dashed` \| `link` \| `text` \| `default` | `default` | | | onClick | Set the handler to handle `click` event | (event: MouseEvent) => void | - | | It accepts all props which native buttons support. diff --git a/components/button/index.zh-CN.md b/components/button/index.zh-CN.md index 0331c8b263..7b0d3eb618 100644 --- a/components/button/index.zh-CN.md +++ b/components/button/index.zh-CN.md @@ -72,7 +72,7 @@ group: | size | 设置按钮大小 | `large` \| `middle` \| `small` | `middle` | | | styles | 语义化结构 style | Record | - | 5.4.0 | | target | 相当于 a 链接的 target 属性,href 存在时生效 | string | - | | -| type | 设置按钮类型 | `primary` \| `ghost` \| `dashed` \| `link` \| `text` \| `default` | `default` | | +| type | 设置按钮类型 | `primary` \| `dashed` \| `link` \| `text` \| `default` | `default` | | | onClick | 点击按钮时的回调 | (event: MouseEvent) => void | - | | 支持原生 button 的其他所有属性。 diff --git a/components/button/style/index.ts b/components/button/style/index.ts index 3737efe86c..1631719dbc 100644 --- a/components/button/style/index.ts +++ b/components/button/style/index.ts @@ -409,6 +409,13 @@ const genTypeButtonStyle: GenerateStyle = (token) => { [`${componentCls}-dashed`]: genDashedButtonStyle(token), [`${componentCls}-link`]: genLinkButtonStyle(token), [`${componentCls}-text`]: genTextButtonStyle(token), + [`${componentCls}-ghost`]: genGhostButtonStyle( + token.componentCls, + token.colorBgContainer, + token.colorBgContainer, + token.colorTextDisabled, + token.colorBorder, + ), }; };