Skip to content

Commit 511166e

Browse files
authored
Header - mobile (#70)
* added mobile css * changes to header mobile * removed br tag * Update announcement.css changed @media width to 768px * removed webkit css * removed gaps and added padding for mobile * fixed a few css errors * padding and margin adjusted * changed css margin * removed unnecessary code * removed unnecessary code * merged from main * added margin * removed comma * ignore id * changed ids to class * a tags formatting * changed top in header nav active to 9rem
1 parent 03887d1 commit 511166e

File tree

4 files changed

+171
-8
lines changed

4 files changed

+171
-8
lines changed

assets/js/bioconductor.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,28 @@ function checkNav() {
3636

3737
window.addEventListener("load", checkNav);
3838

39+
//Mobile siteHead js
40+
document.addEventListener("DOMContentLoaded", function () {
41+
const hamburger = document.querySelector(".hamburger");
42+
const navMenu = document.querySelector(".header-nav");
43+
44+
function mobileMenu() {
45+
hamburger.classList.toggle("active");
46+
navMenu.classList.toggle("active");
47+
}
48+
49+
window.addEventListener("click", mobileMenu);
50+
51+
const navLink = document.querySelectorAll(".mobile-link");
52+
53+
function closeMenu() {
54+
hamburger.classList.remove("active");
55+
navMenu.classList.remove("active");
56+
}
57+
58+
navLink.forEach((n) => n.addEventListener("click", closeMenu));
59+
});
60+
3961
function log(message) {
4062
if (fb_lite) {
4163
//console.log(message);

assets/style/announcement.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,14 @@
3434
color: #fff;
3535
stroke: #fff;
3636
}
37+
38+
@media (width <= 768px) {
39+
.announcement {
40+
display: flex;
41+
padding: 0.625rem;
42+
justify-content: center;
43+
align-items: flex-start;
44+
gap: 0.5rem;
45+
text-align: center;
46+
}
47+
}

assets/style/header.css

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ header {
2020
align-items: center;
2121
}
2222

23-
.header-desktop {
23+
.header-nav {
2424
display: flex;
2525
flex-direction: row;
2626
align-items: center;
@@ -137,3 +137,125 @@ input:focus::placeholder {
137137
background: var(--primary-p400);
138138
color: #fff;
139139
}
140+
141+
.nav-mobile {
142+
display: none;
143+
}
144+
145+
.bar {
146+
display: block;
147+
width: 25px;
148+
height: 3px;
149+
border-radius: 25px;
150+
margin: 5px auto;
151+
transition: all 0.3s ease-in-out;
152+
background-color: var(--misc-dark);
153+
}
154+
155+
@media (width <= 768px) {
156+
.header-size {
157+
justify-content: space-between;
158+
align-items: center;
159+
padding: 1rem 0.5rem;
160+
}
161+
162+
.header-nav {
163+
position: fixed;
164+
flex-direction: column;
165+
width: 100vw;
166+
top: -100%;
167+
left: 0;
168+
background-color: #fff;
169+
transition: 0.3s;
170+
gap: 0;
171+
z-index: -1;
172+
}
173+
174+
.header-nav.active {
175+
top: 9rem;
176+
}
177+
178+
.nav-mobile {
179+
display: flex;
180+
flex-direction: row;
181+
align-items: center;
182+
gap: 0.7rem;
183+
}
184+
185+
.nav-mobile h6 {
186+
margin: 0;
187+
}
188+
189+
.nav-links {
190+
flex-direction: column;
191+
gap: 0;
192+
padding-left: 2rem;
193+
margin-top: 0.5rem;
194+
border-top: 1px solid var(--neutral-n75);
195+
padding-top: 0.5rem;
196+
}
197+
198+
.nav-links a {
199+
text-decoration: none !important;
200+
width: 100vw;
201+
border-bottom: 1px solid var(--neutral-n75);
202+
padding-left: 1.5rem;
203+
padding-bottom: 1rem;
204+
}
205+
206+
.search-container {
207+
height: 2.5rem;
208+
display: flex;
209+
width: calc(100vw - 3rem);
210+
align-items: center;
211+
justify-content: space-between;
212+
padding-left: 0.75rem;
213+
padding-right: 0;
214+
}
215+
216+
.header-button {
217+
background-image: var(--gradient-brand);
218+
color: var(--primary-p400);
219+
display: flex;
220+
width: 100%;
221+
border-radius: 0%;
222+
align-items: center;
223+
padding-top: 1rem;
224+
padding-bottom: 1rem;
225+
}
226+
227+
.get-started {
228+
background: none;
229+
color: #fff;
230+
flex-direction: column;
231+
align-items: flex-start;
232+
margin: 0.5rem;
233+
}
234+
235+
.get-started svg {
236+
display: none;
237+
}
238+
239+
.nav-links a,
240+
.search-container,
241+
.header-button {
242+
margin: 0.5rem 0;
243+
}
244+
245+
.hamburger {
246+
display: block;
247+
cursor: pointer;
248+
}
249+
250+
.hamburger.active .bar:nth-child(2) {
251+
opacity: 0;
252+
}
253+
254+
.hamburger.active .bar:nth-child(1) {
255+
transform: translateY(8px) rotate(45deg);
256+
}
257+
258+
.hamburger.active .bar:nth-child(3) {
259+
transform: translateY(-8px) rotate(-45deg);
260+
}
261+
}

layouts/components/header.html

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
</a>
1313
</div>
1414

15-
<nav class="header-desktop">
15+
<nav class="header-nav">
1616
<div class="nav-links">
17-
<a class="format-bold" href="/about/">About</a>
18-
<a class="format-bold" href="/developers/">Developers</a>
19-
<a class="format-bold" href="/help/">Learn</a>
17+
<a class="format-bold mobile-link" href="/about/">About</a>
18+
<a class="format-bold mobile-link" href="/developers/">Developers</a>
19+
<a class="format-bold mobile-link" href="/help/">Learn</a>
2020
</div>
21-
22-
<div class="search-container">
21+
<div class="search-container mobile-link">
2322
<form
2423
class="site-search"
2524
id="search-form"
@@ -36,7 +35,7 @@
3635
</form>
3736
</div>
3837

39-
<a class="header-button format-bold" href="/install/">
38+
<a class="header-button format-bold mobile-link" href="/install/">
4039
<span class="get-started format-bold">
4140
Get Started
4241
<svg
@@ -57,5 +56,14 @@
5756
</span>
5857
</a>
5958
</nav>
59+
60+
<div class="nav-mobile">
61+
<h6>Menu</h6>
62+
<div class="hamburger">
63+
<span class="bar"></span>
64+
<span class="bar"></span>
65+
<span class="bar"></span>
66+
</div>
67+
</div>
6068
</div>
6169
</header>

0 commit comments

Comments
 (0)