Skip to content

Commit

Permalink
feat(closeMenu): close modal when menuItem is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
KatvonRivia committed Nov 29, 2019
1 parent cac3981 commit 59e6b97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/scripts/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Menu: FunctionComponent = () => {
<MenuIcon />
</button>
{isOpen && (
<ul className={styles.menuList}>
<ul className={styles.menuList} onClick={() => setIsOpen(false)}>
{menuItems.map(menuItem => {
const Icon = menuItem.icon;

Expand Down
3 changes: 2 additions & 1 deletion src/scripts/components/projection-menu/projection-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ const ProjectionMenu: FunctionComponent = () => {
const intl = useIntl();
const projections = Object.values(GlobeProjection);
const dispatch = useDispatch();
const [isOpen, setIsOpen] = useState(false);
const onProjectionClick = (projection: GlobeProjection) => {
setIsOpen(false);
dispatch(setGlobeProjectionAction(projection));
};
const [isOpen, setIsOpen] = useState(false);
const onButtonClickHandler = () => setIsOpen(!isOpen);

return (
Expand Down

0 comments on commit 59e6b97

Please sign in to comment.