Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Fix dropdown menu on tool pages not closing on click
Browse files Browse the repository at this point in the history
  • Loading branch information
voidxnull committed Sep 7, 2016
1 parent 7b46ce1 commit c8e6d4d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/tools/menu-1.js
Expand Up @@ -38,6 +38,10 @@ class Menu1 extends React.Component {
this.setState({ opened: !this.state.opened });
};

handleClickOnItem = () => {
this.setState({ opened: false });
};

onClickOutside = () => {
this.setState({ opened: false });
};
Expand All @@ -60,7 +64,14 @@ class Menu1 extends React.Component {
{this.state.opened &&
<div className="tools_menu_1__dropdown">
{items.map((item, index) => (
<Link className="tools_menu_1__item" key={index} to={item.path}>{item.name}</Link>
<Link
className="tools_menu_1__item"
key={index}
to={item.path}
onClick={this.handleClickOnItem}
>
{item.name}
</Link>
))}
</div>
}
Expand Down

0 comments on commit c8e6d4d

Please sign in to comment.