feat: Add theme system with dark mode and CSS custom properties#7
Open
kashish2508 wants to merge 5 commits into
Open
feat: Add theme system with dark mode and CSS custom properties#7kashish2508 wants to merge 5 commits into
kashish2508 wants to merge 5 commits into
Conversation
…provider and useTheme hook\n- CSS custom properties for all colors (theme.css)\n- ThemeToggle button in Navbar with system preference detection\n- Persist theme choice in localStorage\n- Migrate all hardcoded colors to CSS variables\n- Smooth transition on theme change
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a complete theme system with light/dark modes via CSS custom properties, a React context with a useTheme hook, and a toggle component placed in the Navbar. Existing component stylesheets are migrated from hardcoded colors to the new design tokens.
Changes:
- New
ThemeContext(with localStorage persistence +prefers-color-schemefallback),ThemeTogglecomponent, andtheme.csstoken set. - Wraps
<App />inThemeProviderand includestheme.cssfromindex.js; body styles use the new tokens. - Migrates
App.css,Dashboard.css,Login.cssto CSS variables; replaces the About link inNavbarwithThemeToggle.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/theme.css | Defines light/dark CSS custom property tokens. |
| src/context/ThemeContext.js | Provider + useTheme hook with persistence and OS preference detection. |
| src/components/ThemeToggle.js | Toggle button with sun/moon glyphs and aria-label. |
| src/components/ThemeToggle.css | Styles for the toggle using nav tokens. |
| src/components/Navbar.js | Adds ThemeToggle; removes the About link. |
| src/index.js | Wraps app in ThemeProvider and imports theme.css. |
| src/index.css | Body uses theme tokens with a color transition. |
| src/App.css | Replaces hardcoded colors with tokens; secondary button repurposed. |
| src/pages/Dashboard.css | Migrates colors/shadows/borders to tokens. |
| src/pages/Login.css | Migrates form/message colors to tokens. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\n\nAdds a complete theme system with dark mode support.\n\n### New Files\n-
ThemeContext.js— Context provider withuseTheme()hook, localStorage persistence, OS preference detection\n-theme.css— CSS custom properties for light/dark themes (20+ design tokens)\n-ThemeToggle.js— Toggle button with sun/moon icons, accessibility label\n\n### Modified Files\n-index.js— Wrapped app inThemeProvider\n-index.css— Uses CSS variables for body styles\n-App.css— Migrated all hardcoded colors to CSS variables\n-Navbar.js— Added ThemeToggle to nav\n-Dashboard.css— All colors use CSS variables\n-Login.css— All colors use CSS variables\n\n### Patterns\n- All colors defined as CSS custom properties in:rootand[data-theme='dark']\n- Context follows provider + hook pattern with error for missing provider\n- Theme persists via localStorage withapp_themekey\n- Falls back toprefers-color-schememedia query\n- Components usedata-testidfor Playwright targeting