-
Notifications
You must be signed in to change notification settings - Fork 639
Update examples/nextjs to use primer/react without styled-components #7094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,3 @@ | ||
| @import '@primer/primitives/dist/css/primitives.css'; | ||
| @import '@primer/primitives/dist/css/functional/themes/light.css'; | ||
| @import '@primer/primitives/dist/css/functional/themes/dark.css'; | ||
|
|
||
| body { | ||
| color: var(--fgColor-default); | ||
| background-color: var(--bgColor-default); | ||
| } | ||
|
Comment on lines
-5
to
-8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we still need these on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty sure these styles never worked because the variables are not defined if
That is still correct Eventually, it would make sense for us to offer a way to have ThemeProvider set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair 😂 lol, those attributes definitely need to be there 😰 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,5 @@ | ||
| 'use client' | ||
|
|
||
| import {Button, Stack} from '@primer/react' | ||
| import {useTheme} from '@primer/styled-react' | ||
| import styled from 'styled-components' | ||
|
|
||
| const StyledDiv = styled.div(({theme}) => { | ||
| return { | ||
| padding: theme.space[5], | ||
| backgroundColor: theme.colors.btn.primary.bg, | ||
| } | ||
| }) | ||
|
|
||
| const ThemeUser = () => { | ||
| const {theme} = useTheme() | ||
| return ( | ||
| <div | ||
| style={{ | ||
| padding: theme?.space[5], | ||
| backgroundColor: theme?.colors.btn.primary.bg, | ||
| }} | ||
| > | ||
| Hello world | ||
| </div> | ||
| ) | ||
| } | ||
| import {Button} from '@primer/react' | ||
|
|
||
| export default function IndexPage() { | ||
| return ( | ||
| <Stack direction="horizontal"> | ||
| <Button variant="primary" style={{padding: 'var(--base-size-32)'}}> | ||
| Hello world | ||
| </Button> | ||
| <div style={{padding: 'var(--base-size-32)', backgroundColor: 'var(--button-primary-bgColor-rest)'}}> | ||
| Hello world | ||
| </div> | ||
| <StyledDiv>Hello world</StyledDiv> | ||
| <ThemeUser /> | ||
| </Stack> | ||
| ) | ||
| return <Button>Hello world</Button> | ||
| } |
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the body styles (
colorandbackground-color) appears intentional since these are now handled by the BaseStyles component in layout.tsx. However, there's no comment explaining this dependency. Consider adding a comment in this file explaining that body styles are managed by the BaseStyles component to prevent confusion if someone tries to add them back.See below for a potential fix: