0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/assets/sass/modules/navbar.scss
Paul Adam Davis c936a855c4 Refactor :focus styles
Closes #61
2014-07-12 12:18:44 +01:00

380 lines
No EOL
8.7 KiB
SCSS

/*
* Navbar styling
*
* Table of Contents
*
* Ghost Logo
* Nav Bar
* Mobile Navigation
*/
/* ==========================================================================
Ghost Logo
========================================================================== */
.ghost-logo {
@include icon($i-ghost) {
line-height: 0;
}
display: block;
float: left;
height: 40px;
padding: 12px 15px;
color: lighten($grey, 10%);
@include box-sizing(border-box);
&:hover,
&:focus {
text-decoration: none;
}
}
.ghost-logo:hover,
.ghost-logo:focus {
color: $lightgrey;
background: darken($darkgrey, 2%);
}
/* ==========================================================================
Nav Bar
========================================================================== */
.navbar {
height: 40px;
font-size: 0.85em;
background: $darkgrey;
@media (max-width: 1000px) {
font-weight: normal;
}
// The main navbar styles, apply to to everything.
nav {
ul {
float: left;
border-left: $grey 1px solid;
border-top: none;
margin: 0;
padding: 0;
}
li {
float: left;
font-size: 1em;
position: relative;
border-right: $grey 1px solid;
a {
display: block;
height: 40px;
padding: 11px 15px;
border-bottom: none;
color: $midgrey;
text-transform: uppercase;
@include box-sizing(border-box);
}
a:hover,
a:focus,
&.active a {
color: $lightgrey;
text-decoration: none;
position: relative;
background: darken($grey, 2%);
box-shadow: 0 -2px 2px rgba(0,0,0,0.2) inset;
}
// Make a little arrow pointing up at the currently active menu item
&.active a:after {
content: "";
position: absolute;
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 0 5px 5px 5px;
border-style: solid;
border-color: $lightbrown transparent;
display: block;
width: 0;
@media (max-width: 400px) {
border-color: #fff transparent;
}
}
ul {
position: absolute;
top: 40px;
right: 0;
min-width: 200px;
background: $darkgrey;
}
li {
width: 100%;
border-right: none;
}
}
// Add some icons to specific nav items
a:before {
margin-right: 5px;
}
.dashboard a {
@include icon($i-stats) {
vertical-align: -10%;
}
}
.content a {
@include icon($i-content);
}
.editor a {
@include icon($i-add);
}
.settings a {
@include icon($i-settings2);
}
} //nav ul
// Style any nav items which have dropdowns
.subnav {
position: relative;
// The anchor which toggles the menu open/closed
> a {
@include icon-after($i-chevron-down, 8px) {
margin-left: 8px;
};
&.active {
color: $lightgrey;
background: darken($grey, 3%);
@include transition(none);
box-shadow: none;
}
}
// The dropdown menu
ul {
display: none;
padding: 7px 0;
border-left: none;
position: absolute;
top: 40px;
left: -1px;
z-index: 800;
background: darken($grey, 3%);
box-shadow: rgba(0,0,0,0.2) 0 4px 6px;
}
li {
list-style: none;
a {
color: $lightgrey;
&:hover,
&:focus {
background: darken($darkgrey, 10%);
@include transition(none);
box-shadow: none;
}
&:before {
margin-right: 1em;
} // space for icons
}
}
.divider {
height: 1px;
margin: 7px 0;
overflow: hidden;
background: $grey;
}
}//.subnav
}//.navbar
// The user menu in the top right corner of the screen
.usermenu.subnav {
position: absolute;
top: 0;
right: 0;
border-right: none;
border-left: $grey 1px solid;
> a {
padding-left: 43px; //15px + 18px avatar + 10px
}
.avatar {
height: 18px;
width: 18px;
border-radius: 50px;
position: absolute;
top: 11px;
left: 15px;
}
> ul {
right: 0;
left: auto;
}
//Add some icons to specific items
.usermenu-profile a {
@include icon($i-user);
}
.usermenu-help a {
@include icon($i-support, 1.1em);
}
.usermenu-shortcuts a {
@include icon($i-pc);
}
.usermenu-signout a {
@include icon($i-power);
}
}
/* ==========================================================================
Mobile Navigation
========================================================================== */
// Yo dawg, I heard you like nav menus so I put nav menus in your nav menus
#global-header {
@media (max-width: 650px) {
.ghost-logo {
@include icon($i-menu, 14px);
height: 40px;
width: 40px;
text-align: center;
padding:12px 0;
@include transition(margin-left 0.3s ease 0s);
.off-canvas & {
margin-left: 280px;
@include transition(margin-left 0.3s ease 0.1s);
}
}
ul {
position: fixed;
overflow: auto;
top: 0;
right: auto;
bottom: 0;
left: -280px;
z-index: 980;
width: 280px;
padding-top: 40px;
font-weight:normal;
background: $darkgrey;
border-left: none;
@include transition(left 0.3s ease 0.2s);
.off-canvas & {
left: 0;
@include transition(left 0.3s ease 0s);
}
}
li {
float: none;
border-right: none;
border-bottom: $grey 1px solid;
a:hover,
a:focus,
&.active a {
box-shadow: none;
}
&.active a:after {
display: none;
}
a:before {
margin-right: 1em;
}
ul {
position: static;
min-width: 0;
background: $darkgrey;
}
li {
width: auto;
}
}
.usermenu {
position: fixed;
top: 0;
right: auto;
bottom: auto;
left: -280px;
height: 40px;
z-index: 990;
width: 279px;
border-left: none;
border-right: darken($grey, 7%) 1px solid;
border-bottom: darken($grey, 5%) 1px solid;
@include gradient(darken($darkgrey, 8%), darken($darkgrey, 3%));
@include transition(left 0.3s ease 0.2s);
.off-canvas & {
left: 0;
@include transition(left 0.3s ease 0s);
}
> a {
&:hover,
&:focus {
background: inherit;
}
&.active {
background: darken($grey, 3%);
}
}
> ul {
padding: 0;
box-shadow: none;
width: 100%;
font-weight: 300;
}
.open {
box-shadow: rgba(0,0,0,0.4) 0 10px 20px;
}
li {
border-bottom: darken($grey, 3%) 1px solid;
a {
background: darken($grey, 3%);
&:hover,
&:focus {
background: darken($grey, 8%);
}
&:before {
margin-right: 1em;
} // space for icons
}
}
.divider {
display: none;
}
}
}
}