diff --git a/client/homebrew/pages/sharePage/sharePage.jsx b/client/homebrew/pages/sharePage/sharePage.jsx index 5adc25bda..7ba049a19 100644 --- a/client/homebrew/pages/sharePage/sharePage.jsx +++ b/client/homebrew/pages/sharePage/sharePage.jsx @@ -29,12 +29,6 @@ const SharePage = createClass({ }; }, - getInitialState : function() { - return { - showDropdown : false - }; - }, - componentDidMount : function() { document.addEventListener('keydown', this.handleControlKeys); }, @@ -57,28 +51,6 @@ const SharePage = createClass({ this.props.brew.shareId; }, - handleDropdown : function(show){ - this.setState({ - showDropdown : show - }); - }, - - renderDropdown : function(){ - if(!this.state.showDropdown) return null; - - return
- - view - - - download - - - clone to new - -
; - }, - render : function(){ return
@@ -90,12 +62,20 @@ const SharePage = createClass({ {this.props.brew.shareId && <> - this.handleDropdown(true)} - onMouseLeave={()=>this.handleDropdown(false)}> - source - {this.renderDropdown()} - + + + source + + + view + + + download + + + clone to new + + } diff --git a/client/homebrew/pages/sharePage/sharePage.less b/client/homebrew/pages/sharePage/sharePage.less index cedb54e25..40b90496a 100644 --- a/client/homebrew/pages/sharePage/sharePage.less +++ b/client/homebrew/pages/sharePage/sharePage.less @@ -2,49 +2,4 @@ .content{ overflow-y : hidden; } - .source.navItem{ - position : relative; - .dropdown{ - position : absolute; - top : 28px; - left : 0px; - z-index : 10000; - width : 100%; - h4{ - display : block; - box-sizing : border-box; - padding : 5px 0px; - background-color : #333; - font-size : 0.8em; - color : #bbb; - text-align : center; - border-top : 1px solid #888; - &:nth-of-type(1){ background-color: darken(@teal, 20%); } - &:nth-of-type(2){ background-color: darken(@purple, 30%); } - } - .item{ - .animate(background-color); - position : relative; - display : block; - width : 100%; - vertical-align : middle; - padding : 13px 5px; - box-sizing : border-box; - background-color : #333; - color : white; - text-decoration : none; - border-top : 1px solid #888; - &:hover{ - background-color : @blue; - } - .title{ - display : inline-block; - overflow : hidden; - width : 100%; - text-overflow : ellipsis; - white-space : nowrap; - } - } - } - } -} \ No newline at end of file +} diff --git a/shared/naturalcrit/nav/nav.jsx b/shared/naturalcrit/nav/nav.jsx index 37243ea98..7587778b5 100644 --- a/shared/naturalcrit/nav/nav.jsx +++ b/shared/naturalcrit/nav/nav.jsx @@ -68,6 +68,46 @@ const Nav = { } }), + dropdown : createClass({ + getInitialState : function() { + return { + showDropdown : false + }; + }, + + handleDropdown : function(show){ + this.setState({ + showDropdown : show + }); + }, + + renderDropdown : function(dropdownChildren){ + if(!this.state.showDropdown) return null; + + return ( +
+ {dropdownChildren} +
+ ); + }, + + render : function () { + const dropdownChildren = React.Children.map(this.props.children, (child, i) => { + // Ignore the first child + if (i < 1) return; + return child; + }); + return ( +
this.handleDropdown(true)} + onMouseLeave={()=>this.handleDropdown(false)}> + {this.props.children[0]} + {this.renderDropdown(dropdownChildren)} +
+ ) + } + }) + }; diff --git a/shared/naturalcrit/nav/nav.less b/shared/naturalcrit/nav/nav.less index fea60b53e..60c55dd85 100644 --- a/shared/naturalcrit/nav/nav.less +++ b/shared/naturalcrit/nav/nav.less @@ -78,4 +78,23 @@ nav{ .navSection:last-child .navItem{ border-left : 1px solid #666; } + .navDropdownContainer{ + position: relative; + .navDropdown { + position : absolute; + top : 28px; + left : 0px; + z-index : 10000; + width : 100%; + .navItem{ + position : relative; + display : block; + width : 100%; + vertical-align : middle; + padding : 8px 5px; + border : 1px solid #888; + border-bottom : 0; + } + } + } }