Skip to content

Commit 778f3b5

Browse files
committed
Add emoji theme switcher to navbar
- Replaced SVG icons with emoji icons (☀️ for light mode, 🌙 for dark mode) - Improved theme toggle button styling with better hover effects - Removed redundant fixed theme toggle button from bottom right - Added scale transform on hover for better interactivity
1 parent e526c58 commit 778f3b5

File tree

2 files changed

+18
-34
lines changed

2 files changed

+18
-34
lines changed

src/components/Header.astro

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,8 @@ const navItems = [
3636
</ul>
3737

3838
<button class="theme-toggle-nav" aria-label="Toggle theme">
39-
<svg class="sun-icon" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
40-
<path d="M10 15a5 5 0 100-10 5 5 0 000 10z"/>
41-
<path d="M10 0v3M10 17v3M0 10h3M17 10h3M2.93 2.93l2.12 2.12M14.95 14.95l2.12 2.12M2.93 17.07l2.12-2.12M14.95 5.05l2.12-2.12"/>
42-
</svg>
43-
<svg class="moon-icon" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
44-
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/>
45-
</svg>
39+
<span class="theme-icon sun-icon">☀️</span>
40+
<span class="theme-icon moon-icon">🌙</span>
4641
</button>
4742

4843
<button class="mobile-menu-toggle" aria-label="Toggle mobile menu">
@@ -134,22 +129,33 @@ const navItems = [
134129
}
135130

136131
.theme-toggle-nav {
137-
padding: 0.5rem;
132+
padding: 0.375rem 0.625rem;
138133
border-radius: 0.5rem;
139134
background-color: transparent;
140135
border: none;
141136
cursor: pointer;
142137
color: var(--color-text-secondary);
143138
transition: all 0.2s ease;
139+
font-size: 1.25rem;
140+
display: flex;
141+
align-items: center;
142+
justify-content: center;
143+
min-width: 2.5rem;
144144
}
145145

146146
.theme-toggle-nav:hover {
147147
background-color: var(--color-bg-secondary);
148-
color: var(--color-primary);
148+
transform: scale(1.1);
149+
}
150+
151+
.theme-icon {
152+
display: flex;
153+
align-items: center;
154+
justify-content: center;
149155
}
150156

151157
.sun-icon {
152-
display: block;
158+
display: flex;
153159
}
154160

155161
.moon-icon {
@@ -161,7 +167,7 @@ const navItems = [
161167
}
162168

163169
html.dark .moon-icon {
164-
display: block;
170+
display: flex;
165171
}
166172

167173
.mobile-menu-toggle {

src/styles/global.css

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -210,26 +210,4 @@ img {
210210
border-top: 1px solid var(--color-border);
211211
}
212212

213-
/* Theme Toggle */
214-
.theme-toggle {
215-
position: fixed;
216-
bottom: 2rem;
217-
right: 2rem;
218-
width: 3rem;
219-
height: 3rem;
220-
border-radius: 50%;
221-
background-color: var(--color-card);
222-
border: 1px solid var(--color-border);
223-
box-shadow: var(--shadow-md);
224-
display: flex;
225-
align-items: center;
226-
justify-content: center;
227-
cursor: pointer;
228-
transition: all 0.2s ease;
229-
z-index: 50;
230-
}
231-
232-
.theme-toggle:hover {
233-
box-shadow: var(--shadow-lg);
234-
transform: scale(1.05);
235-
}
213+
/* Theme Toggle - Removed fixed button since we have one in navbar */

0 commit comments

Comments
 (0)