Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
6d9ce62f
Unverified
Commit
6d9ce62f
authored
Nov 16, 2023
by
rodrigo
Committed by
GitHub
Nov 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: update styled-components (#56457)
Co-authored-by:
Lee Robinson
<
me@leerob.io
>
parent
f163dd09
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
54 deletions
+53
-54
package.json
examples/with-styled-components-babel/package.json
+7
-8
_document.tsx
examples/with-styled-components-babel/pages/_document.tsx
+2
-1
tsconfig.json
examples/with-styled-components-babel/tsconfig.json
+7
-5
package.json
examples/with-styled-components-rtl/package.json
+6
-9
tsconfig.json
examples/with-styled-components-rtl/tsconfig.json
+5
-3
cards.tsx
examples/with-styled-components/components/cards.tsx
+2
-8
package.json
examples/with-styled-components/package.json
+6
-7
_app.tsx
examples/with-styled-components/pages/_app.tsx
+2
-2
_document.tsx
examples/with-styled-components/pages/_document.tsx
+5
-2
about.tsx
examples/with-styled-components/pages/about.tsx
+1
-1
index.tsx
examples/with-styled-components/pages/index.tsx
+2
-2
tsconfig.json
examples/with-styled-components/tsconfig.json
+8
-6
No files found.
examples/with-styled-components-babel/package.json
View file @
6d9ce62f
{
"private"
:
true
,
"scripts"
:
{
"dev"
:
"next"
,
"dev"
:
"next
dev
"
,
"build"
:
"next build"
,
"start"
:
"next start"
},
...
...
@@ -9,14 +9,13 @@
"next"
:
"latest"
,
"react"
:
"^18.2.0"
,
"react-dom"
:
"^18.2.0"
,
"react-is"
:
"^18.2.0"
,
"styled-components"
:
"^5.3.5"
"styled-components"
:
"^6.1.0"
},
"devDependencies"
:
{
"@types/node"
:
"
18.7.14
"
,
"@types/react"
:
"^18.
0.18
"
,
"@types/
styled-components"
:
"5.1.26
"
,
"babel-plugin-styled-components"
:
"^2.
0.7
"
,
"typescript"
:
"
4.8
.2"
"@types/node"
:
"
^18.18.3
"
,
"@types/react"
:
"^18.
2.33
"
,
"@types/
react-dom"
:
"^18.2.14
"
,
"babel-plugin-styled-components"
:
"^2.
1.4
"
,
"typescript"
:
"
^5.2
.2"
}
}
examples/with-styled-components-babel/pages/_document.tsx
View file @
6d9ce62f
import
Document
,
{
DocumentContext
,
DocumentInitialProps
}
from
'next/document'
import
type
{
DocumentContext
,
DocumentInitialProps
}
from
'next/document'
import
Document
from
'next/document'
import
{
ServerStyleSheet
}
from
'styled-components'
export
default
class
MyDocument
extends
Document
{
...
...
examples/with-styled-components-babel/tsconfig.json
View file @
6d9ce62f
...
...
@@ -4,16 +4,18 @@
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
false
,
"forceConsistentCasingInFileNames"
:
true
,
"strict"
:
true
,
"noEmit"
:
true
,
"incremental"
:
true
,
"esModuleInterop"
:
true
,
"module"
:
"esnext"
,
"moduleResolution"
:
"
node
"
,
"moduleResolution"
:
"
bundler
"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
,
"jsx"
:
"preserve"
"jsx"
:
"preserve"
,
"incremental"
:
true
,
"paths"
:
{
"@/*"
:
[
"./*"
]
}
},
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
],
"exclude"
:
[
"node_modules"
]
...
...
examples/with-styled-components-rtl/package.json
View file @
6d9ce62f
{
"private"
:
true
,
"scripts"
:
{
"dev"
:
"next"
,
"dev"
:
"next
dev
"
,
"build"
:
"next build"
,
"start"
:
"next start"
},
...
...
@@ -9,16 +9,13 @@
"next"
:
"latest"
,
"react"
:
"^18.2.0"
,
"react-dom"
:
"^18.2.0"
,
"react-is"
:
"^18.2.0"
,
"styled-components"
:
"^5.3.6"
,
"styled-components"
:
"^6.1.0"
,
"stylis-plugin-rtl"
:
"^2.1.1"
},
"devDependencies"
:
{
"@types/node"
:
"^18.11.9"
,
"@types/react"
:
"^18.0.25"
,
"@types/react-dom"
:
"^18.0.9"
,
"@types/styled-components"
:
"^5.1.26"
,
"babel-plugin-styled-components"
:
"^2.0.7"
,
"typescript"
:
"^4.9.3"
"@types/node"
:
"^18.18.3"
,
"@types/react"
:
"^18.2.33"
,
"@types/react-dom"
:
"^18.2.14"
,
"typescript"
:
"^5.2.2"
}
}
examples/with-styled-components-rtl/tsconfig.json
View file @
6d9ce62f
...
...
@@ -5,15 +5,17 @@
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
true
,
"forceConsistentCasingInFileNames"
:
true
,
"noEmit"
:
true
,
"esModuleInterop"
:
true
,
"module"
:
"esnext"
,
"moduleResolution"
:
"
node
"
,
"moduleResolution"
:
"
bundler
"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
,
"jsx"
:
"preserve"
,
"incremental"
:
true
"incremental"
:
true
,
"paths"
:
{
"@/*"
:
[
"./*"
]
}
},
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
,
"styled.d.ts"
],
"exclude"
:
[
"node_modules"
]
...
...
examples/with-styled-components/components/cards.tsx
View file @
6d9ce62f
...
...
@@ -27,22 +27,16 @@ const Card = styled.div`
}
`
const
Styled
A
=
styled
.
a
`
const
Styled
Link
=
styled
(
Link
)
`
margin: 0 0 1rem 0;
font-size: 1.5rem;
`
const
StyledLink
=
({
href
,
name
})
=>
(
<
Link
href=
{
href
}
passHref
legacyBehavior
>
<
StyledA
>
{
name
}
</
StyledA
>
</
Link
>
)
export
default
function
Cards
()
{
return
(
<
FlexContainer
>
<
Card
>
<
StyledLink
href=
"/about"
name=
"About Page →"
/
>
<
StyledLink
href=
"/about"
>
About Page
→
</
StyledLink
>
</
Card
>
</
FlexContainer
>
)
...
...
examples/with-styled-components/package.json
View file @
6d9ce62f
{
"private"
:
true
,
"scripts"
:
{
"dev"
:
"next"
,
"dev"
:
"next
dev
"
,
"build"
:
"next build"
,
"start"
:
"next start"
},
...
...
@@ -9,13 +9,12 @@
"next"
:
"latest"
,
"react"
:
"^18.2.0"
,
"react-dom"
:
"^18.2.0"
,
"styled-components"
:
"^
5.3.5
"
"styled-components"
:
"^
6.1.0
"
},
"devDependencies"
:
{
"@types/node"
:
"^18.0.0"
,
"@types/react"
:
"^18.0.14"
,
"@types/react-dom"
:
"^18.0.5"
,
"@types/styled-components"
:
"^5.1.25"
,
"typescript"
:
"^4.7.4"
"@types/node"
:
"^18.18.3"
,
"@types/react"
:
"^18.2.33"
,
"@types/react-dom"
:
"^18.2.14"
,
"typescript"
:
"^5.2.2"
}
}
examples/with-styled-components/pages/_app.tsx
View file @
6d9ce62f
import
type
{
AppProps
}
from
'next/app'
import
{
ThemeProvider
,
DefaultTheme
}
from
'styled-components'
import
GlobalStyle
from
'
..
/components/globalstyles'
import
{
ThemeProvider
,
type
DefaultTheme
}
from
'styled-components'
import
GlobalStyle
from
'
@
/components/globalstyles'
const
theme
:
DefaultTheme
=
{
colors
:
{
...
...
examples/with-styled-components/pages/_document.tsx
View file @
6d9ce62f
import
Document
,
{
DocumentContext
}
from
'next/document'
import
type
{
DocumentContext
,
DocumentInitialProps
}
from
'next/document'
import
Document
from
'next/document'
import
{
ServerStyleSheet
}
from
'styled-components'
export
default
class
MyDocument
extends
Document
{
static
async
getInitialProps
(
ctx
:
DocumentContext
)
{
static
async
getInitialProps
(
ctx
:
DocumentContext
):
Promise
<
DocumentInitialProps
>
{
const
sheet
=
new
ServerStyleSheet
()
const
originalRenderPage
=
ctx
.
renderPage
...
...
examples/with-styled-components/pages/about.tsx
View file @
6d9ce62f
import
Link
from
'next/link'
import
{
Container
,
Main
,
Title
,
Description
}
from
'
..
/components/sharedstyles'
import
{
Container
,
Main
,
Title
,
Description
}
from
'
@
/components/sharedstyles'
export
default
function
About
()
{
return
(
...
...
examples/with-styled-components/pages/index.tsx
View file @
6d9ce62f
...
...
@@ -5,8 +5,8 @@ import {
Title
,
Description
,
CodeTag
,
}
from
'
..
/components/sharedstyles'
import
Cards
from
'
..
/components/cards'
}
from
'
@
/components/sharedstyles'
import
Cards
from
'
@
/components/cards'
export
default
function
Home
()
{
return
(
...
...
examples/with-styled-components/tsconfig.json
View file @
6d9ce62f
...
...
@@ -4,17 +4,19 @@
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
false
,
"forceConsistentCasingInFileNames"
:
true
,
"strict"
:
true
,
"noEmit"
:
true
,
"incremental"
:
true
,
"esModuleInterop"
:
true
,
"module"
:
"esnext"
,
"moduleResolution"
:
"bundler"
,
"resolveJsonModule"
:
true
,
"moduleResolution"
:
"node"
,
"isolatedModules"
:
true
,
"jsx"
:
"preserve"
"jsx"
:
"preserve"
,
"incremental"
:
true
,
"paths"
:
{
"@/*"
:
[
"./*"
]
}
},
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
],
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
,
"styled.d.ts"
],
"exclude"
:
[
"node_modules"
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment