Skip to content

feat(frontend): add dark mode with theme toggle and localStorage pers…#453

Open
oncleweynom wants to merge 1 commit into
Web3Novalabs:mainfrom
oncleweynom:feat/dark-mode-theme-toggle
Open

feat(frontend): add dark mode with theme toggle and localStorage pers…#453
oncleweynom wants to merge 1 commit into
Web3Novalabs:mainfrom
oncleweynom:feat/dark-mode-theme-toggle

Conversation

@oncleweynom
Copy link
Copy Markdown

What
Adds manual dark mode support to the app — a toggle button in the navbar lets users switch between light and dark themes, with their preference saved across sessions.

Why
The codebase already had dark: Tailwind classes in place but no mechanism to activate them. Dark mode was purely driven by the OS setting with no user control. This completes the implementation.

Changes
globals.css
— migrated dark mode from prefers-color-scheme media query to .dark class strategy using Tailwind v4's @variant
layout.tsx
— added a synchronous inline script that reads localStorage and applies .dark before React hydrates, eliminating flash of wrong theme. Added suppressHydrationWarning on
ThemeToggle.tsx
— icon button (sun/moon) that reads from and writes to the theme store
Navbar.tsx
— mounts ThemeToggle between the Pools link and ConnectWallet
themeStore.ts
— Zustand store managing theme, setTheme, and toggleTheme. Writes to localStorage on every change
index.ts
— exports useThemeStore and Theme type
index.ts
— exports ThemeToggle
Behaviour
First visit: checks localStorage first, falls back to prefers-color-scheme
Toggle: switches theme instantly, persists choice to localStorage
No flash: inline script runs before paint, before hydration
All existing dark: classes across the app activate automatically — no page-level changes needed
Build
next build --webpack passes clean ✓
ESLint + Prettier pre-commit hooks pass ✓

close #430

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 29, 2026

@oncleweynom Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Implement Dark Mode / Theme Toggle

1 participant