0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 04:22:40 +00:00

Merge branch 'collaspeNav' into snippets

This commit is contained in:
Scott Tolksdorf
2017-03-21 00:15:34 -04:00
6 changed files with 42 additions and 11 deletions

View File

@@ -2,7 +2,12 @@ var React = require('react');
var Nav = require('naturalcrit/nav/nav.jsx');
module.exports = function(props){
return <Nav.item newTab={true} href='https://github.com/stolksdorf/homebrewery/issues' color='red' icon='fa-bug'>
return <Nav.item
{...props}
newTab={true}
href='https://github.com/stolksdorf/homebrewery/issues'
color='red'
icon='fa-bug'>
report issue
</Nav.item>
};

View File

@@ -3,6 +3,7 @@ var Nav = require('naturalcrit/nav/nav.jsx');
module.exports = function(props){
return <Nav.item
{...props}
className='patreon'
newTab={true}
href='https://www.patreon.com/stolksdorf'

View File

@@ -24,10 +24,10 @@ const HomePage = React.createClass({
renderNavbar : function(){
return <Navbar>
<Nav.section>
<PatreonNavItem />
<IssueNavItem />
<Nav.item newTab={true} href='/changelog' color='purple' icon='fa-file-text-o'>
Changelog
<PatreonNavItem collaspe={true} />
<IssueNavItem collaspe={true} />
<Nav.item newTab={true} href='/changelog' color='purple' icon='fa-star' collaspe={true}>
What's new
</Nav.item>
<RecentNavItem.both />
<AccountNavItem />

View File

@@ -47,7 +47,7 @@ const NewPage = React.createClass({
<Nav.item color='purple' icon='fa-file-pdf-o' onClick={Actions.localPrint}>
get PDF
</Nav.item>
<Items.Issue />
<Items.Issue collaspe={true} />
<Items.Account />
</Nav.section>
</Navbar>

View File

@@ -38,28 +38,29 @@ var Nav = {
href : null,
newTab : false,
onClick : function(){},
color : null
color : null,
collaspe : false
};
},
handleClick : function(){
this.props.onClick();
},
render : function(){
var classes = cx('navItem', this.props.color, this.props.className);
var classes = cx('navItem', this.props.color, this.props.className, {collaspe : this.props.collaspe});
var icon;
if(this.props.icon) icon = <i className={'fa ' + this.props.icon} />;
const props = _.omit(this.props, ['newTab']);
const props = _.omit(this.props, ['newTab', 'collaspe']);
if(this.props.href){
return <a {...props} className={classes} target={this.props.newTab ? '_blank' : '_self'} >
{this.props.children}
<span>{this.props.children}</span>
{icon}
</a>
}else{
return <div {...props} className={classes} onClick={this.handleClick} >
{this.props.children}
<span>{this.props.children}</span>
{icon}
</div>
}

View File

@@ -1,3 +1,4 @@
nav{
background-color : #333;
.navContent{
@@ -41,6 +42,7 @@ nav{
}
.navItem{
.animate(background-color);
display : inline-block;
padding : 8px 12px;
cursor : pointer;
background-color : #333;
@@ -53,6 +55,28 @@ nav{
margin-left : 5px;
font-size : 13px;
}
&.collaspe{
overflow : hidden;
i{
margin-left : 0px;
}
span{
display : inline-block;
visibility : hidden;
overflow : hidden;
width : 0px;
white-space : nowrap;
}
&:hover{
span{
visibility : visible;
width : auto;
}
i{
margin-left : 5px;
}
}
}
&.tealLight:hover{ background-color : @tealLight };
&.teal:hover{ background-color : @teal };
&.greenLight:hover{ background-color : @greenLight };