Skip to content

Commit 9d7a86e

Browse files
committed
Removed toggle and forced dark mode; for now.
1 parent 2123a5f commit 9d7a86e

4 files changed

Lines changed: 16 additions & 45 deletions

File tree

src/components/Footer.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
22
import Icon from './Icon.astro';
3+
import { version as astroVersion } from 'astro/package.json';
4+
35
const currentYear = new Date().getFullYear();
46
const endCopyYear = new Date().getFullYear() + 2;
57
---
68

79
<footer class="footer-shell glass-panel flush">
810
<div class="group">
911
<p>
10-
Designed & Developed in Austin, Texas with <a href="https://astro.build/">Astro 5.14.1</a>
12+
Designed & Developed in Austin, Texas with <a href="https://astro.build/">Astro v{astroVersion}</a>
1113
<Icon icon="rocket-launch" size="1.2em" />
1214
</p>
1315
<p>&copy; {currentYear} - {endCopyYear} Abdon Morales.</p>

src/components/MainHead.astro

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,9 @@ const canonicalURL = new URL(Astro.url.pathname, Astro.site ?? 'https://abdonmor
6666
/>
6767
</noscript>
6868
<script is:inline>
69-
// This code is inlined in the head to make dark mode instant & blocking.
70-
const getThemePreference = () => {
71-
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
72-
return localStorage.getItem('theme');
73-
}
74-
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
75-
};
76-
const isDark = getThemePreference() === 'dark';
77-
document.documentElement.classList[isDark ? 'add' : 'remove']('theme-dark');
78-
79-
if (typeof localStorage !== 'undefined') {
80-
// Watch the document element and persist user preference when it changes.
81-
const observer = new MutationObserver(() => {
82-
const isDark = document.documentElement.classList.contains('theme-dark');
83-
localStorage.setItem('theme', isDark ? 'dark' : 'light');
84-
});
85-
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
86-
}
69+
// Force dark mode for now; toggle intentionally disabled.
70+
document.documentElement.classList.add('theme-dark');
71+
try {
72+
localStorage.setItem('theme', 'dark');
73+
} catch (_) {}
8774
</script>

src/components/Nav.astro

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
import Icon from './Icon.astro';
3-
import ThemeToggle from './ThemeToggle';
43
import type { iconPaths } from './IconPaths';
54
65
/** Main menu items */
@@ -108,9 +107,9 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[]
108107
))
109108
}
110109
</div>
111-
<div class="theme-toggle">
112-
<ThemeToggle client:load />
113-
</div>
110+
{/*
111+
TODO: Re-enable ThemeToggle after redesign; currently removed per request.
112+
*/}
114113
</div>
115114
</div>
116115
</nav>

src/layouts/BaseLayout.astro

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,11 @@ import {
4949
} from '../utilities/assetOptimization';
5050
import { createCompressionMonitor } from '../utilities/compressionMonitor';
5151

52-
// Set up theme
53-
const savedTheme = localStorage.getItem('theme');
54-
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
55-
const theme = savedTheme || (prefersDark ? 'dark' : 'light');
56-
if (theme === 'dark') {
57-
document.documentElement.classList.add('theme-dark');
58-
} else {
59-
document.documentElement.classList.remove('theme-dark');
60-
}
61-
62-
// Set up theme change listener
63-
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
64-
const handleChange = (e: MediaQueryListEvent) => {
65-
if (!localStorage.getItem('theme')) {
66-
if (e.matches) {
67-
document.documentElement.classList.add('theme-dark');
68-
} else {
69-
document.documentElement.classList.remove('theme-dark');
70-
}
71-
}
72-
};
73-
mediaQuery.addEventListener('change', handleChange);
52+
// Force dark mode for now; re-enable dynamic toggle later.
53+
document.documentElement.classList.add('theme-dark');
54+
try {
55+
localStorage.setItem('theme', 'dark');
56+
} catch (_) {}
7457

7558
// Clean up and optimize loading
7659
if (document.readyState === 'loading') {

0 commit comments

Comments
 (0)