From 8923d59860edf8aee8bcf96f9704051a36b95e9b Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 22 Apr 2022 14:16:54 +0800 Subject: [PATCH 1/5] fix: small table selection dropdown margin issue close #35167 --- components/table/style/size.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/table/style/size.less b/components/table/style/size.less index f05d269866..b64d3bb710 100644 --- a/components/table/style/size.less +++ b/components/table/style/size.less @@ -32,6 +32,11 @@ } } } + + // https://github.com/ant-design/ant-design/issues/35167 + .@{table-prefix-cls}-selection-column { + padding-inline-start: @padding-horizontal / 4; + } } } From 7d822f1b263f6b0aeedb2475d6cda5a5f48494e6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 22 Apr 2022 14:58:02 +0800 Subject: [PATCH 2/5] fix: small table selection dropdown margin issue (#35173) close #35167 --- components/table/style/index.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/table/style/index.less b/components/table/style/index.less index abf4bd9079..68ab41591a 100644 --- a/components/table/style/index.less +++ b/components/table/style/index.less @@ -456,7 +456,7 @@ cursor: pointer; transition: all 0.3s; margin-inline-start: 100%; - padding-inline-start: @padding-xss; + padding-inline-start: @table-padding-horizontal-md / 4; .@{iconfont-css-prefix} { color: @table-header-icon-color; From 6a00bddadeef36519dc5450deef8d1c8f6fd462a Mon Sep 17 00:00:00 2001 From: zombiej Date: Fri, 22 Apr 2022 15:33:01 +0800 Subject: [PATCH 3/5] docs: Update Dropdown demo --- .../__snapshots__/demo-extend.test.ts.snap | 51 +++++++++++-------- .../__tests__/__snapshots__/demo.test.js.snap | 51 +++++++++++-------- components/dropdown/demo/dropdown-button.md | 5 +- 3 files changed, 66 insertions(+), 41 deletions(-) diff --git a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap index cb04769392..57ec90d637 100644 --- a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -4270,28 +4270,39 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md extend context co class="ant-btn ant-btn-default ant-dropdown-trigger" type="button" > - - Button - - - - + Button + +
+ + + +
+
- - Button - - - - + Button +
+
+ + + +
+
diff --git a/components/dropdown/demo/dropdown-button.md b/components/dropdown/demo/dropdown-button.md index ddc6f8c830..15f9264e02 100644 --- a/components/dropdown/demo/dropdown-button.md +++ b/components/dropdown/demo/dropdown-button.md @@ -74,7 +74,10 @@ export default () => ( From e14ec001a11d083e3c4520b5b6c68791e4e57fa3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 22 Apr 2022 16:01:20 +0800 Subject: [PATCH 4/5] fix: small/middle table selection dropdown margin issue (#35174) * fix: small/middle table selection dropdown margin issue * Update index.less --- components/table/style/index.less | 2 +- components/table/style/size.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/table/style/index.less b/components/table/style/index.less index 68ab41591a..cf49f1d4c2 100644 --- a/components/table/style/index.less +++ b/components/table/style/index.less @@ -456,7 +456,7 @@ cursor: pointer; transition: all 0.3s; margin-inline-start: 100%; - padding-inline-start: @table-padding-horizontal-md / 4; + padding-inline-start: (@table-padding-horizontal / 4); .@{iconfont-css-prefix} { color: @table-header-icon-color; diff --git a/components/table/style/size.less b/components/table/style/size.less index b64d3bb710..2f864ade48 100644 --- a/components/table/style/size.less +++ b/components/table/style/size.less @@ -35,7 +35,7 @@ // https://github.com/ant-design/ant-design/issues/35167 .@{table-prefix-cls}-selection-column { - padding-inline-start: @padding-horizontal / 4; + padding-inline-start: (@padding-horizontal / 4); } } } From f8e7cba353d4d10c2fc2ef35ac938032aac34a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 22 Apr 2022 17:40:52 +0800 Subject: [PATCH 5/5] refactor: Simplify Button Group Style (#35175) * chore: refactor grp with context * test: Update snapshot * chore: clean up * test: fix test case * chore: clean up * test: fix test --- .../__tests__/unreachableException.test.js | 8 -- components/_util/unreachableException.ts | 7 -- .../__snapshots__/demo-extend.test.ts.snap | 16 ++-- .../__tests__/__snapshots__/demo.test.ts.snap | 16 ++-- components/button/__tests__/index.test.tsx | 13 ++-- components/button/button-group.tsx | 75 ++++++++++--------- components/button/button.tsx | 21 ++++-- components/button/style/mixin.less | 22 ------ .../__snapshots__/demo-extend.test.ts.snap | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- 10 files changed, 78 insertions(+), 108 deletions(-) delete mode 100644 components/_util/__tests__/unreachableException.test.js delete mode 100644 components/_util/unreachableException.ts diff --git a/components/_util/__tests__/unreachableException.test.js b/components/_util/__tests__/unreachableException.test.js deleted file mode 100644 index 4019e4fedc..0000000000 --- a/components/_util/__tests__/unreachableException.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import UnreachableException from '../unreachableException'; - -describe('UnreachableException', () => { - it('error thrown matches snapshot', () => { - const exception = new UnreachableException('some value'); - expect(exception.error.message).toMatchInlineSnapshot(`"unreachable case: \\"some value\\""`); - }); -}); diff --git a/components/_util/unreachableException.ts b/components/_util/unreachableException.ts deleted file mode 100644 index 424a2e5f61..0000000000 --- a/components/_util/unreachableException.ts +++ /dev/null @@ -1,7 +0,0 @@ -export default class UnreachableException { - error: Error; - - constructor(value: never) { - this.error = new Error(`unreachable case: ${JSON.stringify(value)}`); - } -} diff --git a/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap index cb90130528..1613c44e88 100644 --- a/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/button/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1016,7 +1016,7 @@ Array [ class="ant-btn-group ant-btn-group-sm" > ); - if (isUnborderedButtonType(type)) { + if (isUnBorderedButtonType(type)) { return buttonNode; } diff --git a/components/button/style/mixin.less b/components/button/style/mixin.less index 96efadc8d5..084ecaa5bf 100644 --- a/components/button/style/mixin.less +++ b/components/button/style/mixin.less @@ -210,28 +210,6 @@ .@{btnClassName}-icon-only { font-size: @font-size-base; } - // size - &-lg > .@{btnClassName}, - &-lg > span > .@{btnClassName} { - .button-size(@btn-height-lg; @btn-padding-horizontal-lg; @btn-font-size-lg; 0); - } - &-lg .@{btnClassName}.@{btnClassName}-icon-only { - .square(@btn-height-lg); - padding-right: 0; - padding-left: 0; - } - &-sm > .@{btnClassName}, - &-sm > span > .@{btnClassName} { - .button-size(@btn-height-sm; @btn-padding-horizontal-sm; @font-size-base; 0); - > .@{iconfont-css-prefix} { - font-size: @font-size-base; - } - } - &-sm .@{btnClassName}.@{btnClassName}-icon-only { - .square(@btn-height-sm); - padding-right: 0; - padding-left: 0; - } } // Base styles of buttons // -------------------------------------------------- diff --git a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap index 57ec90d637..34d698b919 100644 --- a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -5170,7 +5170,7 @@ exports[`renders ./components/dropdown/demo/loading.md extend context correctly class="ant-btn-group ant-btn-group-sm ant-dropdown-button" >