Skip to content

Commit 49ff891

Browse files
goutham-subramanyamgithub-actions[bot]praveen-murali-ind
authored
Fixed isActive state and added isDisabled state in MenuItem Button (#1492)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Praveen Murali <itspraveenmurali@gmail.com>
1 parent 6980033 commit 49ff891

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

lib/components/Dropdown/MenuItem/MenuItemButton.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const MenuItemButton = ({
1717
children,
1818
className,
1919
isActive,
20+
isDisabled,
2021
style,
2122
prefix,
2223
suffix,
@@ -45,11 +46,13 @@ const MenuItemButton = ({
4546
"neeto-ui-dropdown__popup-menu-item-btn",
4647
className,
4748
{
48-
"neeto-ui-dropdown__popup-menu-item-btn": isActive,
49+
"neeto-ui-dropdown__popup-menu-item-btn--active": isActive,
50+
"neeto-ui-dropdown__popup-menu-item-btn--disabled": isDisabled,
4951
"neeto-ui-dropdown__popup-menu-item-btn--style-danger":
5052
style === ITEM_BTN_STYLES.danger,
5153
}
5254
)}
55+
disabled={isDisabled}
5356
{...otherProps}
5457
{...elementSpecificProps}
5558
>
@@ -82,6 +85,10 @@ MenuItemButton.propTypes = {
8285
* To specify the active state of the MenuItem.
8386
*/
8487
isActive: PropTypes.bool,
88+
/**
89+
* To specify whether the MenuItem is disabled.
90+
*/
91+
isDisabled: PropTypes.bool,
8592
/**
8693
* To specify an internal route to which the button points to.
8794
*/

lib/styles/components/_dropdown.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,18 @@
107107
outline-color: transparent;
108108
border-radius: 0;
109109

110-
&.disabled {
110+
&--disabled {
111111
cursor: not-allowed;
112-
color: rgb(var(--neeto-ui-gray-500));
112+
opacity: 0.5;
113113
}
114114

115-
&:hover,
116-
&:focus {
115+
&:hover:not(:disabled):not(.neeto-ui-dropdown__popup-menu-item-btn--active),
116+
&:focus:not(:disabled):not(.neeto-ui-dropdown__popup-menu-item-btn--active){
117117
background-color: rgb(var(--neeto-ui-gray-200));
118118
}
119119

120-
&.active {
121-
background-color: rgb(var(--neeto-ui-gray-800));
120+
&--active {
121+
background-color: rgb(var(--neeto-ui-primary-500));
122122
color: rgb(var(--neeto-ui-white));
123123
}
124124

stories/Components/Dropdown.stories.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export const Default = (args) => {
5656
{listItems.map((item, idx) => (
5757
<MenuItem.Button key={idx}>{item}</MenuItem.Button>
5858
))}
59+
<MenuItem.Button isActive>Active</MenuItem.Button>
60+
<MenuItem.Button isDisabled>Disabled</MenuItem.Button>
5961
<Divider />
6062
<MenuItem.Button style="danger">Delete</MenuItem.Button>
6163
</Menu>

0 commit comments

Comments
 (0)