Skip to content

Conversation

@ZachBeta
Copy link

@ZachBeta ZachBeta commented Oct 1, 2025

first draft of dark mode for #91

})();
`,
}}
/>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is probably a better way to handle this but this avoids a flashbang on load so that it doesn't start light and quickly flip to dark

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should rely on the css value, rather than relying on javascript


// Update cookie and refresh server-side data
await setThemeCookie(newTheme);
router.refresh();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt be necessary (will cause some issues too) since you already are manually updating className


export type Theme = 'light' | 'dark';

export async function getTheme(): Promise<Theme | null> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will create a server action (since use server) which isn't necessary since its only called from the server.

setTheme can be a server action, but it should include validation (theme can only be light|dark)

@ZachBeta
Copy link
Author

ZachBeta commented Oct 1, 2025

will revisit again, ideally later today time permitting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants