Skip to content

feat: add dark mode toggle and dark theme support across all components#5

Open
RichardBray wants to merge 1 commit intomainfrom
feature/dark-mode
Open

feat: add dark mode toggle and dark theme support across all components#5
RichardBray wants to merge 1 commit intomainfrom
feature/dark-mode

Conversation

@RichardBray
Copy link
Copy Markdown
Member

Add class-based dark mode with toggle button in navbar. Apply dark: variants to all components (navbar, hero, blurb, faq, footer, kitform, blog, contact, MDX renderer). Include dark background and orange accent styles.

Also add two new blog posts: cc_bs.md and dont-mcp.mdx

Add class-based dark mode with toggle button in navbar. Apply dark: variants
to all components (navbar, hero, blurb, faq, footer, kitform, blog, contact,
MDX renderer). Include dark background and orange accent styles.

Also add two new blog posts: cc_bs.md and dont-mcp.mdx
const [dark, setDark] = useState(false);
const [mounted, setMounted] = useState(false);

useEffect(() => {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

is it possible to just use localstorage instgead of useEffecr, what is the benefit of use effect?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The useEffect is necessary because localStorage is not available during server-side rendering (SSR). Since Waku pre-renders pages statically, calling localStorage directly at the top level would crash or cause a hydration mismatch. The useEffect ensures we only access localStorage after the component has mounted in the browser.

const Blurb: React.FC = () => {
return (
<section className="pb-16 bg-primary-50">
<section className="pb-16 bg-primary-50 dark:bg-primary-900/30">
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

what is 900/30?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

bg-primary-900/30 is Tailwind syntax — primary-900 is the color and /30 sets its opacity to 30%. This gives a subtle dark background in dark mode without being too heavy.

className="p-2 rounded-lg text-primary-600 hover:text-primary-800 dark:text-primary-300 dark:hover:text-primary-100 transition-colors"
>
{dark ? (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can the svg be in a seperate component, what is the benefit of it being inline here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call — I've extracted both SVGs into a separate src/components/icons.tsx file as SunIcon and MoonIcon components. The toggle now just imports and uses them. This keeps the component cleaner and makes the icons reusable.

@@ -0,0 +1,163 @@
# Setting Up Claude Code Telemetry with Better Stack
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

note: this is here temporarily and might need to be moved to a different directory, can we make a note of that somewhere? msaybe in the readme or somewhere you think makes sense

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added a TODO comment at the top of the file noting it's temporary and may need to be moved.

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.

1 participant