Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Add hideOnClick prop to DropdownMenuItem
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Aug 9, 2020
1 parent d7818b1 commit fca2b2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/bumbag/src/DropdownMenu/DropdownMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { DropdownMenuContext } from './DropdownMenu';
import * as styles from './styles';

export type LocalDropdownMenuItemProps = {
hideOnClick?: boolean;
/** Icon that appears on the right side of the menu item. */
iconAfter?: IconProps['icon'];
iconAfterProps?: Omit<IconProps, 'icon'>;
Expand Down Expand Up @@ -37,6 +38,7 @@ const useProps = createHook<DropdownMenuItemProps>(
registerItem,
currentId,
hide,
hideOnClick,
move,
next,
onClick,
Expand Down Expand Up @@ -126,11 +128,11 @@ const useProps = createHook<DropdownMenuItemProps>(
{iconAfter && <Icon className={iconAfterClassName} icon={iconAfter} {...iconAfterProps} />}
</React.Fragment>
),
onClick: bindFns(onClick, hide, dropdownMenu.hide),
onClick: hideOnClick ? bindFns(onClick, hide, dropdownMenu.hide) : onClick,
tabIndex: props.isTabbable ? boxProps.tabIndex : undefined,
};
},
{ defaultProps: { isTabbable: true }, themeKey: 'DropdownMenu.Item' }
{ defaultProps: { hideOnClick: true, isTabbable: true }, themeKey: 'DropdownMenu.Item' }
);

export const DropdownMenuItem = createComponent<DropdownMenuItemProps>(
Expand Down

0 comments on commit fca2b2b

Please sign in to comment.