From 715ee88f38f3574b70dcaad54dc0226db08a09e5 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 23 Jun 2021 18:20:02 +1200 Subject: [PATCH 1/4] Add dropdown to `/share` for `source` to unify options: * "view" - View Source * "download" - Download Source * "clone to new" - Create New Brew from this Brew --- client/homebrew/pages/sharePage/sharePage.jsx | 36 ++++++++++++++-- .../homebrew/pages/sharePage/sharePage.less | 43 +++++++++++++++++++ 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/client/homebrew/pages/sharePage/sharePage.jsx b/client/homebrew/pages/sharePage/sharePage.jsx index 1411c3175..a4393314b 100644 --- a/client/homebrew/pages/sharePage/sharePage.jsx +++ b/client/homebrew/pages/sharePage/sharePage.jsx @@ -29,6 +29,12 @@ const SharePage = createClass({ }; }, + getInitialState : function() { + return { + showDropdown : false + }; + }, + componentDidMount : function() { document.addEventListener('keydown', this.handleControlKeys); }, @@ -51,6 +57,28 @@ 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
@@ -61,11 +89,11 @@ const SharePage = createClass({ - + this.handleDropdown(true)} + onMouseLeave={()=>this.handleDropdown(false)}> source - - - download + {this.renderDropdown()} diff --git a/client/homebrew/pages/sharePage/sharePage.less b/client/homebrew/pages/sharePage/sharePage.less index 7d0820257..089ccae31 100644 --- a/client/homebrew/pages/sharePage/sharePage.less +++ b/client/homebrew/pages/sharePage/sharePage.less @@ -2,4 +2,47 @@ .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; + box-sizing : border-box; + padding : 13px 5px; + 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 From ff7585b69d20cb1903a0e37b440b2af345a14e79 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 23 Jun 2021 21:16:33 +1200 Subject: [PATCH 2/4] Clean up unnecessary code. --- client/homebrew/pages/sharePage/sharePage.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/homebrew/pages/sharePage/sharePage.jsx b/client/homebrew/pages/sharePage/sharePage.jsx index a4393314b..5137f03df 100644 --- a/client/homebrew/pages/sharePage/sharePage.jsx +++ b/client/homebrew/pages/sharePage/sharePage.jsx @@ -67,13 +67,13 @@ const SharePage = createClass({ if(!this.state.showDropdown) return null; return ; From 94fdca084a92fb701cb01b462eafe4c36ae84b6b Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Fri, 25 Jun 2021 20:45:47 +1200 Subject: [PATCH 3/4] Horizontal and vertical alignment adjustments. --- client/homebrew/pages/sharePage/sharePage.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/sharePage/sharePage.less b/client/homebrew/pages/sharePage/sharePage.less index 089ccae31..a0ce2ba21 100644 --- a/client/homebrew/pages/sharePage/sharePage.less +++ b/client/homebrew/pages/sharePage/sharePage.less @@ -26,8 +26,9 @@ .animate(background-color); position : relative; display : block; + width : 100%; + vertical-align : middle; box-sizing : border-box; - padding : 13px 5px; background-color : #333; color : white; text-decoration : none; From 205ed8e30edafe2c2aa48d2a7aff86a9e0944c3c Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Fri, 25 Jun 2021 20:50:40 +1200 Subject: [PATCH 4/4] Padding fix for dropdown items. --- client/homebrew/pages/sharePage/sharePage.less | 1 + 1 file changed, 1 insertion(+) diff --git a/client/homebrew/pages/sharePage/sharePage.less b/client/homebrew/pages/sharePage/sharePage.less index a0ce2ba21..cedb54e25 100644 --- a/client/homebrew/pages/sharePage/sharePage.less +++ b/client/homebrew/pages/sharePage/sharePage.less @@ -28,6 +28,7 @@ display : block; width : 100%; vertical-align : middle; + padding : 13px 5px; box-sizing : border-box; background-color : #333; color : white;