Skip to content

Commit 5939426

Browse files
committed
Add Github edit and social media links to mobile menu
1 parent f47a814 commit 5939426

File tree

4 files changed

+97
-15
lines changed

4 files changed

+97
-15
lines changed

_includes/header.html

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ <h1 class="m-0">
1616
</h1>
1717

1818
<!-- Mobile menu button -->
19-
<button class="nav__menu-trigger" type="button" aria-label="Navigation Menu" aria-expanded="false">
19+
<button class="nav__menu-trigger hidden-md" type="button" aria-label="Navigation Menu" aria-expanded="false">
20+
<span class="visually-hidden">Menu</span>
2021
<span class="hamburger">
2122
<span class="hamburger__inner"></span>
2223
</span>
2324
</button>
2425

25-
<!-- Page List -->
26+
<!-- Page list -->
2627
{%- if page_paths -%}
27-
<ul class="nav-list list--inline monospace">
28+
<ul class="nav-list list--plain monospace">
2829
{%- for path in page_paths -%}
2930
{%- assign my_page = site.pages | where: "path", path | first -%}
3031
{% assign class = nil %}
@@ -36,7 +37,28 @@ <h1 class="m-0">
3637
<a class="nav-list__link {{ class }}" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
3738
</li>
3839
{%- endif -%}
39-
{%- endfor -%}
40+
{%- endfor -%}
41+
42+
<!-- Social icons (mobile only) -->
43+
<li class="nav-social-list hidden-md">
44+
<a class="nav-social-list__item text-white no-underline" href="https://www.twitter.com/{{ site.twitter_username| cgi_escape | escape }}">
45+
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/social-icons.svg#twitter' | relative_url }}"></use></svg>
46+
</a>
47+
<a class="nav-social-list__item text-white no-underline" href="https://www.facebook.com/{{ site.facebook_username| cgi_escape | escape }}">
48+
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/social-icons.svg#facebook' | relative_url }}"></use></svg>
49+
</a>
50+
<a class="nav-social-list__item text-white no-underline" href="https://www.linkedin.com/company/{{ site.linkedin_username| cgi_escape | escape }}">
51+
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/social-icons.svg#linkedin' | relative_url }}"></use></svg>
52+
</a>
53+
<a class="nav-social-list__item text-white no-underline" href="https://github.com/{{ site.github_username| cgi_escape | escape }}">
54+
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/social-icons.svg#github' | relative_url }}"></use></svg>
55+
</a>
56+
</li>
57+
58+
<!-- Github links (mobile only) -->
59+
<li class="hidden-md monospace fs-md">
60+
<a class="nav-github-link text-white" href="{{site.github.repository_url}}/edit/{{ site.branch }}/{{page.path}}">Improve this Page</a><a class="nav-github-link text-white" href="{{site.github.repository_url}}/commits/{{ site.branch }}/{{page.path}}">Page History</a>
61+
</li>
4062
</ul>
4163
{%- endif -%}
4264
</nav>

assets/_sass/base/_colors.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
////////////////////
44

55
$cabernet-dark: #5A1D41;
6-
$cabernet-dark: #6A244D;
6+
$cabernet: #6A244D;
77
$cabernet-light: #7F1652;
88

99
$midnight-dark: #001927;

assets/_sass/base/_helpers.scss

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
////////////////////
2+
// Color Modifiers
3+
////////////////////
4+
5+
.text-white {color: $white}
6+
7+
////////////////////
8+
// Font Size
9+
////////////////////
10+
11+
.fs-md {
12+
font-size: rem-calc(14px);
13+
}
14+
15+
////////////////////
16+
// Links
17+
////////////////////
18+
19+
.no-underline {
20+
text-decoration: none;
21+
}
22+
123
////////////////////
224
// List
325
////////////////////
@@ -27,6 +49,24 @@
2749
display: none !important;
2850
}
2951

52+
.hidden-sm {
53+
@media (min-width: $bp-sm) {
54+
display: none !important;
55+
}
56+
}
57+
58+
.hidden-md {
59+
@media (min-width: $bp-md) {
60+
display: none !important;
61+
}
62+
}
63+
64+
.hidden-lg {
65+
@media (min-width: $bp-lg) {
66+
display: none !important;
67+
}
68+
}
69+
3070
// Hide only visually, but have it available for screen readers:
3171
// https://a11yproject.com/posts/how-to-hide-content/
3272
.visually-hidden:not(:focus):not(:active) {

assets/_sass/component/_navigation.scss

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,21 @@ $nav-zindex: 10;
4646
justify-content: center;
4747
align-items: center;
4848
outline: none;
49+
}
4950

50-
@media (min-width: $bp-md) {
51-
display: none;
52-
}
53-
51+
// Prevent background page from scrolling when menu is active
52+
.menu-active {
53+
overflow: hidden;
5454
}
5555

5656
.nav-list {
5757
@media (max-width: $bp-md) {
58-
position: absolute;
59-
top: $nav-height-sm;
58+
position: fixed;
59+
top: 0;
6060
right: 0;
6161
bottom: 0;
6262
left: 0;
63-
height: calc(100vh - #{$nav-height-sm});
64-
padding: rem-calc(20px) $cp-sm;
63+
padding: $nav-height-sm $cp-sm rem-calc(20px);
6564
background-color: $teal;
6665
display: flex;
6766
flex-direction: column;
@@ -71,23 +70,25 @@ $nav-zindex: 10;
7170
transition-duration: 0.2s;
7271
transition-property: opacity, visibility, transform;
7372
transition-timing-function: ease-in-out;
73+
z-index: -1;
7474
}
7575
}
7676

77+
// Show nav list when .menu-active class is toggled
7778
.menu-active .nav-list{
7879
opacity: 1;
7980
visibility: visible;
8081
}
8182

82-
8383
.nav-list__item {
84+
display: inline;
8485
border-bottom: 1px solid $teal-dark;
8586

8687
@media (min-width: $bp-md) {
8788
border-bottom: none;
8889
}
8990

90-
&:not(:last-of-type) {
91+
&:not(:first-of-type) {
9192

9293
@media (min-width: $bp-md) {
9394
margin-left: rem-calc(20px);
@@ -118,6 +119,25 @@ $nav-zindex: 10;
118119
}
119120
}
120121

122+
// Mobile social media icons
123+
.nav-social-list {
124+
margin-top: auto;
125+
margin-bottom: rem-calc(15px);
126+
border-bottom: 1px solid $teal-dark;
127+
}
128+
129+
.nav-social-list__item {
130+
display: inline-block;
131+
padding: rem-calc(20px 8px 20px 0);
132+
}
133+
134+
// Mobile github links
135+
.nav-github-link:not(:last-child) {
136+
margin-right: rem-calc(12px);
137+
padding-right: rem-calc(12px);
138+
border-right: 1px solid $teal-dark;
139+
}
140+
121141
////////////////////
122142
// Skip Nav Link
123143
////////////////////

0 commit comments

Comments
 (0)