Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Header } from "~/header";
* bypassing the optimization glitch.
*/
export const App = () => (
<div className="mx-auto flex min-h-screen max-w-7xl flex-col bg-gray-50 p-5 dark:bg-gray-950">
<div className="mx-auto flex min-h-screen max-w-7xl flex-col bg-gray-50 p-5 transition-colors duration-300 dark:bg-gray-950">
<Header />

<main className="flex flex-1 flex-col px-0 py-8 sm:px-2 md:px-6 lg:px-12 xl:px-20">
Expand Down
5 changes: 1 addition & 4 deletions app/use-dark-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ const DarkThemeStore = createStore(
* Subscribe to changes in the dark theme store to ensure only one
* listener updates the DOM, regardless of how many components use the hook.
*/
DarkThemeStore.subscribe(() => {
// Read state directly from the store.
const isDark = DarkThemeStore.state;

DarkThemeStore.subscribe((isDark) => {
if (isDark) {
document.documentElement.classList.add("dark");
return;
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
if (isDark) {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
</script>

Expand Down