Skip to content

Commit

Permalink
Feat: overflow menu item disable (carbon-design-system#810)
Browse files Browse the repository at this point in the history
* feat: Added disable prop to OverflowMenuItem, resolves carbon-design-system#809

* fix(OverflowMenu): added tabindex and changed syntax
  • Loading branch information
bellsworth13 authored and alisonjoseph committed Apr 19, 2018
1 parent b5bd74d commit e8561c1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/OverflowMenuItem/OverflowMenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const OverflowMenuItem = ({
itemText,
hasDivider,
isDelete,
disabled,
closeMenu,
onClick,
primaryFocus,
Expand All @@ -23,6 +24,7 @@ const OverflowMenuItem = ({
{
'bx--overflow-menu--divider': hasDivider,
'bx--overflow-menu-options__option--danger': isDelete,
'bx--overflow-menu-options__option--disabled': disabled,
},
wrapperClassName
);
Expand All @@ -41,7 +43,9 @@ const OverflowMenuItem = ({
{...other}
{...primaryFocusProp}
className={overflowMenuBtnClasses}
onClick={handleClick}>
disabled={disabled}
onClick={handleClick}
tabIndex={disabled ? -1 : 0}>
{itemText}
</button>
</li>
Expand Down Expand Up @@ -75,6 +79,10 @@ OverflowMenuItem.propTypes = {
* `true` to make this menu item a "danger button".
*/
isDelete: PropTypes.bool,
/**
* `true` to make this menu item disabled.
*/
disabled: PropTypes.bool,

onBlur: PropTypes.func,
onClick: PropTypes.func,
Expand All @@ -100,6 +108,7 @@ OverflowMenuItem.propTypes = {
OverflowMenuItem.defaultProps = {
hasDivider: false,
isDelete: false,
disabled: false,
itemText: 'Provide itemText',
onClick: () => {},
};
Expand Down

0 comments on commit e8561c1

Please sign in to comment.