Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #187, SettingsList now closes when clicking on the UI #842

Merged
merged 1 commit into from
Oct 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions app/public/js/components/header/settingsNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SettingsButton extends Component {
class SettingsList extends Component {
render () {
return (
<ul className="subNav_nav" data-isvisible={this.props.isVisible}>
<ul className="subNav_nav" data-isvisible={this.props.isVisible} onClick={this.props.onClick}>
<li className="subNav_nav_item" data-ng-controller="AboutCtrl">
<a data-ng-click="openModal()">About</a>
</li>
Expand All @@ -34,21 +34,40 @@ class SettingsApp extends Component {
super(props);

this.state = {
isVisible: false
isVisible: false,
isMouseIn: false
};

//Close when we click on the UI
window.addEventListener('click', this.closeOut.bind(this), false);
}

stopClose (e) {
e.stopPropagation();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this abstraction please? just use e.stopPropagation(); where you need to

};

closeOut () {
this.setState({
isVisible: false
});
};

toggleSettings () {
this.setState({
isVisible: !this.state.isVisible
});
};

stopEventsAndToggleSettings (e) {
this.stopClose(e);
this.toggleSettings();
};

render () {
return (
<div>
<SettingsButton onClick={this.toggleSettings.bind(this)} />
<SettingsList isVisible={this.state.isVisible} />
<SettingsButton onClick={this.stopEventsAndToggleSettings.bind(this)} />
<SettingsList onClick={this.stopClose.bind(this)} isVisible={this.state.isVisible} />
</div>
)
}
Expand Down