1
Fork 0

Make navbar look better on mobile

This commit is contained in:
Jake Howard 2016-01-08 19:05:50 +00:00
parent cb691cbea0
commit a67915b611
3 changed files with 44 additions and 32 deletions

View file

@ -9,7 +9,7 @@ export default class Item extends React.Component {
); );
} }
return ( return (
<li><a href={this.props.href}>{icon} {this.props.children}</a></li> <li><a href={this.props.href}>{icon}{this.props.children}</a></li>
); );
} }
} }

View file

@ -14,7 +14,7 @@ export default class NavBar extends React.Component {
<Header /> <Header />
<div className="collapse navbar-collapse" id="navbar"> <div className="collapse navbar-collapse" id="navbar">
<ul className="nav navbar-nav home-button hidden-sm"> <ul className="nav navbar-nav home-button hidden-sm">
<li className="active home"><a href=""><i className="icon ion-home"></i></a></li> <Item href="" icon="ion-home" />
</ul> </ul>
<ul className="nav navbar-nav" id="navigation"> <ul className="nav navbar-nav" id="navigation">
<Dropdown title="Projects"> <Dropdown title="Projects">

View file

@ -1,24 +1,3 @@
.dropdown-menu {
@media (min-width: @screen-sm) {
right: auto;
left: 50%;
transform: translate(-50%, 0);
opacity: 0;
.transition(~"ease-in-out .2s all");
}
&.dropup {
bottom: 100%;
top: initial;
}
&.dropdown {
top: 100%;
bottom: initial;
}
.open & {
opacity: 1;
}
}
#navigation { #navigation {
@media (min-width: @screen-xs-max) { @media (min-width: @screen-xs-max) {
.flexbox(); .flexbox();
@ -32,35 +11,65 @@
@media (min-width: @screen-md-min) { @media (min-width: @screen-md-min) {
margin-right: 23px; margin-right: 23px;
} }
@media (max-width: @screen-sm-max) {
margin-right: 10px;
margin-left: 11px;
}
& > a { & > a {
@media (min-width: @screen-md-min) { @media (min-width: @screen-md-min) {
padding: 15px 10px; padding: 15px 10px;
} }
@media (max-width: @screen-sm-max) { @media (max-width: @screen-xs-max) {
padding: 15px 3px; padding: 15px 15px;
} }
} }
} }
.dropdown-menu {
@media (min-width: @screen-sm) {
right: auto;
left: 50%;
transform: translate(-50%, 0);
opacity: 0;
.transition(~"ease-in-out .2s all");
}
&.dropup {
bottom: 100%;
top: initial;
}
&.dropdown {
top: 100%;
bottom: initial;
}
.open & {
opacity: 1;
}
a {
padding-left: 20px;
}
}
} }
.navbar { .navbar {
border-radius: 0; border-radius: 0;
.home-button a {
.transition(~"ease-in-out .3s color");
}
} }
.navbar-nav.nav { .navbar-nav.nav {
margin: 0; margin: 0;
} }
.navbar-toggle {
right: 10px;
}
#navbar-container { #navbar-container {
z-index: 0; z-index: 0;
width: 96%; width: 96%;
left: 2%; left: 2%;
margin: 0; margin: 0;
z-index: 10000; z-index: 10000;
i + * {
margin-right: 5px;
}
& .container-fluid{ & .container-fluid{
padding-right: 0; padding-right: 0;
padding-left: 0; padding-left: 0;
@ -73,7 +82,8 @@
@media (max-width: @screen-sm) { @media (max-width: @screen-sm) {
position: fixed; position: fixed;
top: 0; top: 0;
width: 100%; width: 95%;
} }
} }
} }
@ -83,8 +93,10 @@
height: 52px; height: 52px;
} }
.home-button { @media (min-width: @screen-xs-max) {
margin-right: 15px !important; .home-button {
margin-right: 15px !important;
}
} }
#navbar { #navbar {