Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use FontAwesome for navigation menu #2959

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _includes/masthead.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{% endif %}
<button class="greedy-nav__toggle hidden" type="button">
<span class="visually-hidden">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle menu" }}</span>
<div class="navicon"></div>
<i class="navicon fas fa-bars fa-lg fa-fw"></i>
</button>
<ul class="hidden-links hidden"></ul>
</nav>
Expand Down
68 changes: 13 additions & 55 deletions _sass/minimal-mistakes/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -332,97 +332,55 @@ body:hover .visually-hidden button {

.navicon {
position: relative;
width: $navicon-width;
height: $navicon-height;
background: $primary-color;
color: $masthead-link-color;
margin: auto;
-webkit-transition: 0.3s;
transition: 0.3s;

&:before,
&:after {
content: "";
position: absolute;
left: 0;
width: $navicon-width;
height: $navicon-height;
background: $primary-color;
&:before {
-webkit-transition: 0.3s;
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 {
&:before {
-webkit-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
top: 0;
width: $navicon-width;
}

/* rotate the lines to form the x shape*/
&:before {
-webkit-transform: rotate3d(0, 0, 1, 45deg);
transform: rotate3d(0, 0, 1, 45deg);
}
&:after {
-webkit-transform: rotate3d(0, 0, 1, -45deg);
transform: rotate3d(0, 0, 1, -45deg);
}
}

.greedy-nav__toggle {
&:before {
@supports (pointer-events: none) {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
background-color: $background-color;
-webkit-transition: $global-transition;
transition: $global-transition;
pointer-events: none;
}
}

.navicon:before {
content: $navicon-open;
}

&.close {
&:before {
opacity: 0.9;
-webkit-transition: $global-transition;
transition: $global-transition;
pointer-events: auto;
}

.navicon:before {
content: $navicon-closed;
}
}
}

.greedy-nav__toggle:hover {
.navicon,
.navicon:before,
.navicon:after {
background: mix(#000, $primary-color, 25%);
}

&.close {
.navicon {
background: transparent;
}
.navicon {
color: $masthead-link-color-hover
}
}

Expand Down
7 changes: 5 additions & 2 deletions _sass/minimal-mistakes/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ $border-radius: 4px !default;
$box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125) !default;
$nav-height: 2em !default;
$nav-toggle-height: 2rem !default;
$navicon-width: 1.5rem !default;
$navicon-height: 0.25rem !default;
$global-transition: all 0.2s ease-in-out !default;
$intro-transition: intro 0.3s both !default;
// These next two items are FontAwesome character codes. See
// https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css
// for alternate codes if overriding with other FontAwesome characters
$navicon-open: "\f0c9" !default; // fa-bars
$navicon-closed: "\f00d" !default; // fa-times