Add "priority plus" navigation pattern for masthead links

This commit is contained in:
Michael Rose
2016-03-21 16:01:19 -04:00
parent 3925087ac2
commit 4df2367e1c
10 changed files with 264 additions and 46 deletions

View File

@@ -16,6 +16,9 @@
@include breakpoint($x-large) {
max-width: $x-large;
}
nav {
z-index: 1;
}
a {
text-decoration: none;
}
@@ -49,25 +52,8 @@
}
.masthead__menu-item {
display: block;
list-style-type: none;
border-bottom: 1px solid $border-color;
font-size: 16px;
&:last-child {
border-bottom: 0 solid transparent;
}
@include breakpoint($small) {
display: inline;
margin-right: 25px;
white-space: nowrap;
border-bottom: 0 solid transparent;
}
a {
display: block;
padding: 10px 0;
@include breakpoint($small) {
display: inline;
padding: 0;
}
}
}
display: block;
list-style-type: none;
font-size: 16px;
white-space: nowrap;
}

View File

@@ -53,4 +53,105 @@
.current {
font-weight: bold;
}
}
/*
Priority plus navigation
========================================================================== */
.greedy-nav {
position: relative;
min-width: 250px;
background: #fff;
a {
display: block;
padding: 10px 20px;
text-decoration: none;
}
button {
position: absolute;
height: 100%;
right: 0;
padding: 0 10px;
border: 0;
outline: none;
background-color: #000;
color: #fff;
cursor: pointer;
}
.visible-links {
display: inline-table;
li {
display: table-cell;
&:first-child {
font-weight: bold;
a {
padding-left: 0;
color: $text-color !important;
}
}
&:last-child {
a {
padding-right: 0;
}
}
}
}
.hidden-links {
position: absolute;
top: 100%;
right: 0;
margin-top: 15px;
padding: 5px;
border: 1px solid $border-color;
border-radius: $border-radius;
background: #fff;
box-shadow: 0 0 10px rgba(#000, 0.25);
a {
font-size: 0.8em;
}
&:before {
content: "";
position: absolute;
top: -11px;
right: 10px;
width: 0;
border-style: solid;
border-width: 0 10px 10px;
border-color: $border-color transparent;
display: block;
z-index: 0;
}
&:after {
content: "";
position: absolute;
top: -10px;
right: 10px;
width: 0;
border-style: solid;
border-width: 0 10px 10px;
border-color: #fff transparent;
display: block;
z-index: 1;
}
li {
display: block;
border-bottom: 1px solid $border-color;
&:last-child {
border-bottom: none;
}
}
}
}

View File

@@ -9,6 +9,7 @@
margin-top: 2em;
padding-left: 2em;
padding-right: 2em;
z-index: 0;
@include breakpoint($large) {
padding-left: 1em;
padding-right: 1em;

View File

@@ -151,31 +151,31 @@
box-shadow: none;
}
&:before {
display: block;
content: "";
position: absolute;
top: -11px;
left: calc(50% - 10px);
width: 0;
border-style: solid;
border-width: 0 10px 10px;
border-color: $border-color transparent;
display: block;
width: 0;
z-index: 0;
top: -11px;
left: calc(50% - 10px);
@include breakpoint($large) {
display: none;
}
}
&:after {
display: block;
content: "";
position: absolute;
top: -10px;
left: calc(50% - 10px);
width: 0;
border-style: solid;
border-width: 0 10px 10px;
border-color: #fff transparent;
display: block;
width: 0;
z-index: 1;
top: -10px;
left: calc(50% - 10px);
@include breakpoint($large) {
display: none;
}

View File

@@ -152,6 +152,62 @@ body:hover .visually-hidden button {
}
/*
Navicons
========================================================================== */
$navicon-width : 32px;
$navicon-height : 4px;
.navicon {
position: relative;
width: $navicon-width;
height: $navicon-height;
background: #fff;
margin: auto;
transition: 0.3s;
&:before,
&:after {
content: "";
position: absolute;
left: 0;
width: $navicon-width;
height: $navicon-height;
background: #fff;
transition: 0.3s;
}
&:before {
top: (-2 * $navicon-height);
}
&:after {
bottom: (-2 * $navicon-height);
}
}
.close .navicon {
// hide the middle line
background: transparent;
// overlay the lines by setting both their top values to 0
&:before, &:after{
transform-origin: 50% 50%;
top: 0;
width: $navicon-width;
}
// rotate the lines to form the x shape
&:before{
transform: rotate3d(0,0,1,45deg);
}
&:after{
transform: rotate3d(0,0,1,-45deg);
}
}
/*
Sticky, fixed to top content
========================================================================== */