cheatsheets/_sass/2017/components/top-nav.scss

128 lines
2.0 KiB
SCSS

.top-nav {
&,
& > .container {
height: 64px;
line-height: 64px;
text-align: center;
position: relative;
}
// Smaller on mobile
@media (max-width: 480px) {
& > .container {
height: 32px;
line-height: 32px;
margin-top: 8px;
}
& {
height: 32px + 8px + 8px;
padding: 8px 0;
border-bottom: solid 1px $dark-line-color;
margin-bottom: 8px;
}
}
// Horiz line
@media (min-width: 481px) {
&::after {
content: '';
display: block;
position: absolute;
left: 40%;
right: 40%;
bottom: 0;
height: 1px;
background: linear-gradient(to right,
transparent,
$dark-line-color 20%,
$dark-line-color 80%,
transparent);
@media (max-width: 480px) {
left: 0;
right: 0;
}
}
}
& > .container {
@include gutter(padding-left);
@include gutter(padding-right);
max-width: $area-width;
margin: 0 auto;
}
}
.top-nav > .container {
& {
display: flex;
align-items: center;
position: relative;
}
& > .left {
flex: 0 0 auto;
line-height: 32px;
}
& > .brand {
flex: 1 1 auto;
}
& > .actions {
flex: 0 0 auto;
display: flex;
}
& > .brand {
@include font-size(-1);
display: inline-block;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 0.05em;
text-decoration: none;
&,
&:visited {
color: $base-text;
}
&:hover {
color: $base-a;
}
}
// Mobile
@media (max-width: 480px) {
& > .brand {
display: none;
}
& > .actions {
margin-left: auto;
}
}
// Desktop: absolute the actions
@media (min-width: 481px) {
& > .actions {
position: absolute;
@include gutter(right);
top: (64px - 32px) / 2;
}
& > .left {
position: absolute;
@include gutter(left);
top: (64px - 32px) / 2;
}
}
// Offset so it doesn't look misasligned
& > .left > .home {
position: relative;
left: -16px;
}
}