diff --git a/js/component/common.js b/js/component/common.js
index 281f15b01..c4f9b7631 100644
--- a/js/component/common.js
+++ b/js/component/common.js
@@ -36,9 +36,36 @@ var menuStyle = {
};
var Menu = React.createClass({
+ handleWindowClick: function(e) {
+ if (this.props.toggleButton && ReactDOM.findDOMNode(this.props.toggleButton).contains(e.target)) {
+ // Toggle button was clicked
+ this.setState({
+ open: !this.state.open
+ });
+ } else if (this.state.open && !this.refs.div.contains(e.target)) {
+ // Menu is open and user clicked outside of it
+ this.setState({
+ open: false
+ });
+ }
+ },
+ propTypes: {
+ openButton: React.PropTypes.element,
+ },
+ getInitialState: function() {
+ return {
+ open: false,
+ };
+ },
+ componentDidMount: function() {
+ window.addEventListener('click', this.handleWindowClick, false);
+ },
+ componentWillUnmount: function() {
+ window.removeEventListener('click', this.handleWindowClick, false);
+ },
render: function() {
return (
-
+
{this.props.children}
);
@@ -74,7 +101,6 @@ var MenuItem = React.createClass({
}
});
-
var creditAmountStyle = {
color: '#216C2A',
fontWeight: 'bold',
@@ -104,6 +130,7 @@ var subPageLogoStyle = {
display: 'block',
marginTop: '36px',
};
+
var SubPageLogo = React.createClass({
render: function() {
return
![](img/lbry-dark-1600x528.png)
;
diff --git a/js/page/home.js b/js/page/home.js
index d3245653e..a05acd075 100644
--- a/js/page/home.js
+++ b/js/page/home.js
@@ -243,19 +243,11 @@ var mainMenuStyle = {
};
var MainMenu = React.createClass({
- propTypes: {
- show: React.PropTypes.bool,
- },
- getDefaultProps: function() {
- return {
- show: false,
- }
- },
render: function() {
var isLinux = /linux/i.test(navigator.userAgent); // @TODO: find a way to use getVersionInfo() here without messy state management
return (
-
-