Summary
Add a theme toggle to let users switch between Light, Dark, and System (desktop) modes smoothly using next-themes and lucide-react (for icons).
Tasks
Files to change
package.json (dependencies added)
app/layout.tsx (~10 lines changed)
components/layout/Navbar.tsx (~30 lines changed)
components/theme-provider.tsx (new, ~20 lines)
components/theme-toggle.tsx (new, ~65 lines)
app/globals.css (~10 lines added for transitions)
Acceptance criteria
- Toggling between Light, Dark, and System modes works instantly
- State is persisted in localStorage (handled by
next-themes)
- No layout shifts or flash of unstyled content on reload (using
suppressHydrationWarning)
npm run build succeeds
Summary
Add a theme toggle to let users switch between Light, Dark, and System (desktop) modes smoothly using
next-themesandlucide-react(for icons).Tasks
next-themesandlucide-reactThemeProvidercomponent usingnext-themesThemeProviderwithinapp/layout.tsxThemeTogglecomponent (Sun, Moon, Monitor icons)ThemeToggleto both the DesktopNavbarand MobileNavbarmenusapp/globals.cssFiles to change
package.json(dependencies added)app/layout.tsx(~10 lines changed)components/layout/Navbar.tsx(~30 lines changed)components/theme-provider.tsx(new, ~20 lines)components/theme-toggle.tsx(new, ~65 lines)app/globals.css(~10 lines added for transitions)Acceptance criteria
next-themes)suppressHydrationWarning)npm run buildsucceeds