0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-11 04:42:42 +00:00

Shift to title wrapper

This commit is contained in:
G.Ambatte
2023-03-15 09:17:05 +13:00
parent 4505308b81
commit 24564a2750
6 changed files with 30 additions and 18 deletions

View File

@@ -14,17 +14,17 @@ const MetadataNav = createClass({
getInitialState : function() { getInitialState : function() {
return { return {
showDropdown : false showMetaWindow : false
}; };
}, },
componentDidMount : function() { componentDidMount : function() {
}, },
handleDropdown : function(show){ toggleMetaWindow : function(){
this.setState({ this.setState((prevProps)=>({
showDropdown : show showMetaWindow : !prevProps.showMetaWindow
}); }));
}, },
getAuthors : function(){ getAuthors : function(){
@@ -42,8 +42,8 @@ const MetadataNav = createClass({
return this.props.brew.systems.join(', '); return this.props.brew.systems.join(', ');
}, },
renderDropdown : function(){ renderMetaWindow : function(){
if(!this.state.showDropdown) return null; if(!this.state.showMetaWindow) return null;
return <div className='dropdown'> return <div className='dropdown'>
<h4>Description</h4> <h4>Description</h4>
@@ -59,10 +59,9 @@ const MetadataNav = createClass({
render : function(){ render : function(){
return <Nav.item icon='fas fa-info-circle' color='grey' className='metadata' return <Nav.item icon='fas fa-info-circle' color='grey' className='metadata'
onMouseEnter={()=>this.handleDropdown(true)} onClick={()=>this.toggleMetaWindow()}>
onMouseLeave={()=>this.handleDropdown(false)}> {this.props.children}
METADATA {this.renderMetaWindow()}
{this.renderDropdown()}
</Nav.item>; </Nav.item>;
} }

View File

@@ -28,7 +28,7 @@
width : 250px; width : 250px;
margin : 0; margin : 0;
padding : 2px; padding : 2px;
background-color : #444; background-color : transparent;
font-family : 'Open Sans', sans-serif; font-family : 'Open Sans', sans-serif;
font-size : 12px; font-size : 12px;
font-weight : 800; font-weight : 800;
@@ -54,6 +54,7 @@
color : white; color : white;
text-align : center; text-align : center;
text-transform : initial; text-transform : initial;
flex-grow : 1;
} }
.save-menu { .save-menu {
.dropdown { .dropdown {
@@ -165,12 +166,19 @@
} }
.metadata.navItem { .metadata.navItem {
position : relative; position : relative;
padding: 0;
align-items: center;
display : flex;
flex-grow: 1;
i{
margin-right: 10px;
}
.dropdown{ .dropdown{
position : absolute; position : absolute;
top : 28px; top : 28px;
left : 0px; left : 0px;
z-index : 10000; z-index : 10000;
width : 350px; width : 100%;
max-height : ~"calc(100vh - 28px)"; max-height : ~"calc(100vh - 28px)";
background-color : #333; background-color : #333;
h4{ h4{

View File

@@ -51,12 +51,13 @@ const SharePage = createClass({
return <div className='sharePage sitePage'> return <div className='sharePage sitePage'>
<Meta name='robots' content='noindex, nofollow' /> <Meta name='robots' content='noindex, nofollow' />
<Navbar> <Navbar>
<Nav.section> <Nav.section classes='titleSection'>
<Nav.item className='brewTitle'>{this.props.brew.title}</Nav.item> <MetadataNav brew={this.props.brew}>
<Nav.item className='brewTitle'>{this.props.brew.title}</Nav.item>
</MetadataNav>
</Nav.section> </Nav.section>
<Nav.section> <Nav.section>
<MetadataNav brew={this.props.brew} />
{this.props.brew.shareId && <> {this.props.brew.shareId && <>
<PrintLink shareId={this.processShareId()} /> <PrintLink shareId={this.processShareId()} />
<Nav.dropdown> <Nav.dropdown>

View File

@@ -1,4 +1,8 @@
.sharePage{ .sharePage{
.navContent .navSection.titleSection {
flex-grow: 1;
justify-content: center;
}
.content{ .content{
overflow-y : hidden; overflow-y : hidden;
} }

View File

@@ -29,7 +29,7 @@ const Nav = {
section : createClass({ section : createClass({
displayName : 'Nav.section', displayName : 'Nav.section',
render : function(){ render : function(){
return <div className='navSection'> return <div className={this.props.classes ? `navSection ${this.props.classes}` : 'navSection'}>
{this.props.children} {this.props.children}
</div>; </div>;
} }

View File

@@ -54,7 +54,7 @@ nav{
.animate(background-color); .animate(background-color);
padding : 8px 12px; padding : 8px 12px;
cursor : pointer; cursor : pointer;
background-color : #333; // background-color : #333;
font-size : 10px; font-size : 10px;
font-weight : 800; font-weight : 800;
color : white; color : white;