From ccf44cbe91529f36222b6847e98b572475cda4d9 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 14 Mar 2023 23:01:29 +1300 Subject: [PATCH] Initial functionality pass --- client/homebrew/navbar/metadata.navitem.jsx | 71 +++++++++++++++++++ client/homebrew/navbar/navbar.less | 29 ++++++++ client/homebrew/pages/sharePage/sharePage.jsx | 2 + 3 files changed, 102 insertions(+) create mode 100644 client/homebrew/navbar/metadata.navitem.jsx diff --git a/client/homebrew/navbar/metadata.navitem.jsx b/client/homebrew/navbar/metadata.navitem.jsx new file mode 100644 index 000000000..cfbbcbabe --- /dev/null +++ b/client/homebrew/navbar/metadata.navitem.jsx @@ -0,0 +1,71 @@ +const React = require('react'); +const createClass = require('create-react-class'); +const _ = require('lodash'); + +const Nav = require('naturalcrit/nav/nav.jsx'); + + +const MetadataNav = createClass({ + DisplayName : 'MetadataNav', + getDefaultProps : function() { + return { + }; + }, + + getInitialState : function() { + return { + showDropdown : false + }; + }, + + componentDidMount : function() { + }, + + handleDropdown : function(show){ + this.setState({ + showDropdown : show + }); + }, + + getAuthors : function(){ + if(!this.props.brew.authors) return 'No authors'; + return this.props.brew.authors.join(', '); + }, + + getTags : function(){ + if(!this.props.brew.tags) return 'No tags'; + return this.props.brew.tags.join(', '); + }, + + getSystems : function(){ + if(!this.props.brew.systems) return 'No systems'; + return this.props.brew.systems.join(', '); + }, + + renderDropdown : function(){ + if(!this.state.showDropdown) return null; + + return
+

Description

+

{this.props.brew.description || 'No description.'}

+

Authors

+

{this.getAuthors()}

+

Tags

+

{this.getTags()}

+

Systems

+

{this.getSystems()}

+
; + }, + + render : function(){ + return this.handleDropdown(true)} + onMouseLeave={()=>this.handleDropdown(false)}> + METADATA + {this.renderDropdown()} + ; + } + +}); + +module.exports = MetadataNav; diff --git a/client/homebrew/navbar/navbar.less b/client/homebrew/navbar/navbar.less index 3bd6a66e1..a4eb570f9 100644 --- a/client/homebrew/navbar/navbar.less +++ b/client/homebrew/navbar/navbar.less @@ -163,6 +163,35 @@ } } } + .metadata.navItem { + position : relative; + .dropdown{ + position : absolute; + top : 28px; + left : 0px; + z-index : 10000; + width : 350px; + max-height : ~"calc(100vh - 28px)"; + background-color : #333; + h4{ + display : block; + box-sizing : border-box; + padding : 5px 0px; + font-size : 0.8em; + color : #bbb; + text-align : center; + border : 1px solid #888; + border-left : 0px; + border-right : 0px; + } + p{ + font-family : 'Open Sans', sans-serif; + font-size : 12px; + font-weight : normal; + text-transform : initial; + } + } + } .warning.navItem{ position : relative; background-color : @orange; diff --git a/client/homebrew/pages/sharePage/sharePage.jsx b/client/homebrew/pages/sharePage/sharePage.jsx index 232c2a1e3..a772197fb 100644 --- a/client/homebrew/pages/sharePage/sharePage.jsx +++ b/client/homebrew/pages/sharePage/sharePage.jsx @@ -5,6 +5,7 @@ const { Meta } = require('vitreum/headtags'); const Nav = require('naturalcrit/nav/nav.jsx'); const Navbar = require('../../navbar/navbar.jsx'); +const MetadataNav = require('../../navbar/metadata.navitem.jsx'); const PrintLink = require('../../navbar/print.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; const Account = require('../../navbar/account.navitem.jsx'); @@ -55,6 +56,7 @@ const SharePage = createClass({ + {this.props.brew.shareId && <>