From 24c066ea7adf3f676afdaf6b53623959bd5ffa4b Mon Sep 17 00:00:00 2001 From: samyar <75088294+samyarkd@users.noreply.github.com> Date: Wed, 7 Dec 2022 14:55:14 +0330 Subject: [PATCH 1/4] fix: dropdown menu item in danger Disable dropdown menu item when type is equal to danger increase disabled CSS specificity remove unnecessary changes fix: remove reordering functions Remove reordering functions by increasing `disable` class on line 350 CSS specificity Revert "fix: remove reordering functions " This reverts commit bd94daaddf973f5f8ef1641ea3081f5aab2fc3a2. --- components/dropdown/style/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dropdown/style/index.ts b/components/dropdown/style/index.ts index ba3fb8f330d9..ff19435aa274 100644 --- a/components/dropdown/style/index.ts +++ b/components/dropdown/style/index.ts @@ -334,7 +334,7 @@ const genBaseStyle: GenerateStyle = (token) => { }, }, - '&-disabled': { + [`&${menuCls}-item-disabled`]: { color: colorTextDisabled, cursor: 'not-allowed', @@ -443,9 +443,9 @@ export default genComponentStyleHook( dropdownEdgeChildPadding: paddingXXS, }); return [ + genStatusStyle(dropdownToken), genBaseStyle(dropdownToken), genButtonStyle(dropdownToken), - genStatusStyle(dropdownToken), ]; }, (token) => ({ From a4441cf1e97ec6ad5b8c549b0778dcd27541a74c Mon Sep 17 00:00:00 2001 From: wuxh Date: Thu, 29 Dec 2022 20:28:59 +0800 Subject: [PATCH 2/4] chore: update style --- components/dropdown/style/index.ts | 4 ++-- components/dropdown/style/status.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/dropdown/style/index.ts b/components/dropdown/style/index.ts index ff19435aa274..ba3fb8f330d9 100644 --- a/components/dropdown/style/index.ts +++ b/components/dropdown/style/index.ts @@ -334,7 +334,7 @@ const genBaseStyle: GenerateStyle = (token) => { }, }, - [`&${menuCls}-item-disabled`]: { + '&-disabled': { color: colorTextDisabled, cursor: 'not-allowed', @@ -443,9 +443,9 @@ export default genComponentStyleHook( dropdownEdgeChildPadding: paddingXXS, }); return [ - genStatusStyle(dropdownToken), genBaseStyle(dropdownToken), genButtonStyle(dropdownToken), + genStatusStyle(dropdownToken), ]; }, (token) => ({ diff --git a/components/dropdown/style/status.ts b/components/dropdown/style/status.ts index 8e7f536dec95..1f6ddb0b21d8 100644 --- a/components/dropdown/style/status.ts +++ b/components/dropdown/style/status.ts @@ -9,7 +9,7 @@ const genStatusStyle: GenerateStyle = (token) => { return { [`${componentCls}, ${componentCls}-menu-submenu`]: { [`${menuCls} ${itemCls}`]: { - [`&${itemCls}-danger`]: { + [`&${itemCls}-danger:not(${itemCls}-disabled)`]: { color: colorError, '&:hover': { From 2e332e6bc031125f5d4dea10f684b6c6b7a8af2e Mon Sep 17 00:00:00 2001 From: wuxh Date: Thu, 29 Dec 2022 20:33:17 +0800 Subject: [PATCH 3/4] chore: update demo ref: https://github.com/ant-design/ant-design/issues/39322 --- components/dropdown/demo/dropdown-button.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/dropdown/demo/dropdown-button.tsx b/components/dropdown/demo/dropdown-button.tsx index 7d0b51eea88b..d2897fed0728 100644 --- a/components/dropdown/demo/dropdown-button.tsx +++ b/components/dropdown/demo/dropdown-button.tsx @@ -28,6 +28,14 @@ const items: MenuProps['items'] = [ label: '3rd menu item', key: '3', icon: , + danger: true, + }, + { + label: '4rd menu item', + key: '4', + icon: , + danger: true, + disabled: true, }, ]; From c92f1ca71c0e0ce9eedb35dfe0c582627f3e5b8a Mon Sep 17 00:00:00 2001 From: wuxh Date: Thu, 29 Dec 2022 20:37:28 +0800 Subject: [PATCH 4/4] test: update snapshot --- .../__snapshots__/demo-extend.test.ts.snap | 456 +++++++++++++++++- 1 file changed, 450 insertions(+), 6 deletions(-) diff --git a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap index 8ef969e6ac1f..716b4be6779f 100644 --- a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -3514,7 +3514,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.tsx extend context c +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
@@ -3796,7 +3870,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.tsx extend context c +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
@@ -4080,7 +4228,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.tsx extend context c +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
@@ -4390,7 +4612,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.tsx extend context c +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
@@ -4675,7 +4971,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.tsx extend context c +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
@@ -4956,7 +5326,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.tsx extend context c +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+