Skip to content

Commit 400d073

Browse files
sarah11918ArmandPhilippotHiDeoodelucis
authored
Merge pull request #44 from bjohansebas/patch
Co-authored-by: ArmandPhilippot <[email protected]> Co-authored-by: HiDeoo <[email protected]> Co-authored-by: delucis <[email protected]> Co-authored-by: sarah11918 <[email protected]>
2 parents 91135e2 + 476dd2a commit 400d073

File tree

8 files changed

+51
-32
lines changed

8 files changed

+51
-32
lines changed

src/components/Hamburger.astro

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/components/Header.astro

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
---
2-
import Hamburger from "./Hamburger.astro";
2+
import Menu from "./Menu.astro";
33
import Navigation from "./Navigation.astro";
44
import ThemeIcon from "./ThemeIcon.astro";
55
---
66

77
<header>
88
<nav>
9-
<Hamburger />
10-
<ThemeIcon />
9+
<div>
10+
<ThemeIcon />
11+
<Menu />
12+
</div>
1113
<Navigation />
1214
</nav>
1315
</header>
16+
17+
<style>
18+
div {
19+
display: flex;
20+
justify-content: space-between;
21+
}
22+
</style>

src/components/Menu.astro

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
---
3+
4+
<button aria-expanded="false" aria-controls="main-menu" class="menu">
5+
Menu
6+
</button>

src/components/Navigation.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
---
3-
<div class="nav-links">
3+
<div id="main-menu" class="nav-links">
44
<a href="/">Home</a>
55
<a href="/about/">About</a>
66
<a href="/blog/">Blog</a>

src/components/ThemeIcon.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
---
44

5-
<button id="themeToggle">
6-
<svg width="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
5+
<button id="themeToggle" aria-label="Toggle theme">
6+
<svg aria-hidden="true" width="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
77
<path
88
class="sun"
99
fill-rule="evenodd"

src/pages/about.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const identity = {
1515
1616
const skills = ["HTML", "CSS", "JavaScript", "React", "Astro", "Writing Docs"];
1717
18-
const skillColor = "navy";
18+
const skillColor = "crimson";
1919
const fontWeight = "bold";
2020
const textCase = "uppercase";
2121
---

src/scripts/menu.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
document.querySelector('.hamburger').addEventListener('click', () => {
2-
document.querySelector('.nav-links').classList.toggle('expanded');
1+
const menu = document.querySelector('.menu')
2+
3+
menu.addEventListener('click', () => {
4+
const isExpanded = menu.getAttribute('aria-expanded') === 'true';
5+
menu.setAttribute('aria-expanded', !isExpanded);
36
});

src/styles/global.css

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,18 @@ h1 {
2222

2323
/* nav styles */
2424

25-
.hamburger {
26-
padding-right: 20px;
27-
cursor: pointer;
25+
.menu {
26+
background-color: #0d0950;
27+
border: none;
28+
color: #fff;
29+
font-size: 1.2rem;
30+
font-weight: bold;
31+
padding: 5px 10px;
2832
}
2933

30-
.hamburger .line {
31-
display: block;
32-
width: 40px;
33-
height: 5px;
34-
margin-bottom: 10px;
35-
background-color: #ff9776;
36-
}
3734

3835
.nav-links {
3936
width: 100%;
40-
top: 5rem;
41-
left: 48px;
42-
background-color: #ff9776;
4337
display: none;
4438
margin: 0;
4539
}
@@ -52,14 +46,15 @@ h1 {
5246
font-size: 1.2rem;
5347
font-weight: bold;
5448
text-transform: uppercase;
49+
color: #0d0950;
5550
}
5651

5752
.nav-links a:hover,
5853
.nav-links a:focus {
5954
background-color: #ff9776;
6055
}
6156

62-
.expanded {
57+
:has(.menu[aria-expanded="true"]) .nav-links {
6358
display: unset;
6459
}
6560

@@ -77,7 +72,7 @@ h1 {
7772
padding: 15px 20px;
7873
}
7974

80-
.hamburger {
75+
.menu {
8176
display: none;
8277
}
8378
}
@@ -87,6 +82,20 @@ html.dark {
8782
color: #fff;
8883
}
8984

85+
.dark .menu {
86+
background-color: #fff;
87+
color: #000;
88+
}
89+
90+
.dark .nav-links a:hover,
91+
.dark .nav-links a:focus {
92+
color: #0d0950;
93+
}
94+
9095
.dark .nav-links a {
9196
color: #fff;
97+
}
98+
99+
.dark a {
100+
color: #ff9776;
92101
}

0 commit comments

Comments
 (0)