Update theming example to remove styled-components#8039
Conversation
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
|
There was a problem hiding this comment.
Pull request overview
This PR updates the examples/theming Next.js App Router example to stop relying on styled-components / @primer/styled-react, and instead use theming APIs directly from @primer/react (including running ThemeProvider in contextOnly mode since theme attributes are already applied to <html>).
Changes:
- Removed the styled-components SSR registry and any remaining
@primer/styled-reactusage from the theming example. - Updated the App Router layout to use
ThemeProvider/BaseStylesfrom@primer/reactwithcontextOnly. - Removed
@primer/styled-reactandstyled-componentsfrom the theming example dependencies.
Show a summary per file
| File | Description |
|---|---|
| package-lock.json | Removes theming workspace’s @primer/styled-react / styled-components dependencies (but needs lock/version alignment). |
| examples/theming/src/app/registry.tsx | Deletes the styled-components SSR registry implementation. |
| examples/theming/src/app/layout.tsx | Switches theming wrapper to @primer/react ThemeProvider (contextOnly) + BaseStyles. |
| examples/theming/src/app/components/ThemePreference/ThemePreference.tsx | Imports useTheme from @primer/react instead of @primer/styled-react. |
| examples/theming/package.json | Removes @primer/styled-react and styled-components from the theming example dependencies. |
Copilot's findings
- Files reviewed: 4/5 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Updates the theming example so it no longer depends on styled-components or the legacy styled-react package.
Changelog
New
N/A
Changed
ThemeProvider,BaseStyles, anduseThemefrom@primer/react.ThemeProviderruns incontextOnlymode because theme attributes are already applied to<html>for App Router hydration.Removed
@primer/styled-reactandstyled-componentsfrom the theming example dependencies.Rollout strategy
Testing & Reviewing
Review the theming example’s App Router layout and theme toggle flow.
Merge checklist