polishing pass

This commit is contained in:
2024-08-23 20:46:46 -05:00
parent ad88da00e6
commit b8efef1a00
15 changed files with 19 additions and 63 deletions

View File

@@ -74,16 +74,13 @@ import Icon from './Icon.astro';
const button = this.querySelector('button')!;
/** Set the theme to dark/light mode. */
const setTheme = (dark: boolean) => {
document.documentElement.classList[dark ? 'add' : 'remove']('theme-dark');
button.setAttribute('aria-pressed', String(dark));
};
// Toggle the theme when a user clicks the button.
button.addEventListener('click', () => setTheme(!this.isDark()));
// Initialize button state to reflect current theme.
setTheme(this.isDark());
}