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
e058fa49
Unverified
Commit
e058fa49
authored
Oct 29, 2020
by
Jip Sterk
Committed by
GitHub
Oct 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unneeded deps & updated example (#17651)
Closes #17626
parent
e20dba2c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
59 deletions
+22
-59
.babelrc
examples/with-emotion/.babelrc
+3
-0
package.json
examples/with-emotion/package.json
+4
-3
_app.js
examples/with-emotion/pages/_app.js
+8
-17
_document.js
examples/with-emotion/pages/_document.js
+0
-33
index.js
examples/with-emotion/pages/index.js
+2
-1
styles.js
examples/with-emotion/shared/styles.js
+5
-5
No files found.
examples/with-emotion/.babelrc
0 → 100644
View file @
e058fa49
{
"presets": ["next/babel", "@emotion/babel-preset-css-prop"]
}
examples/with-emotion/package.json
View file @
e058fa49
...
@@ -11,11 +11,12 @@
...
@@ -11,11 +11,12 @@
"keywords"
:
[],
"keywords"
:
[],
"author"
:
"Thomas Greco"
,
"author"
:
"Thomas Greco"
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"devDependencies"
:
{
"@emotion/babel-preset-css-prop"
:
"10.0.27"
},
"dependencies"
:
{
"dependencies"
:
{
"@emotion/core"
:
"10.0.
27
"
,
"@emotion/core"
:
"10.0.
35
"
,
"@emotion/styled"
:
"10.0.27"
,
"@emotion/styled"
:
"10.0.27"
,
"emotion"
:
"10.0.27"
,
"emotion-server"
:
"10.0.27"
,
"next"
:
"latest"
,
"next"
:
"latest"
,
"react"
:
"^16.7.0"
,
"react"
:
"^16.7.0"
,
"react-dom"
:
"^16.7.0"
"react-dom"
:
"^16.7.0"
...
...
examples/with-emotion/pages/_app.js
View file @
e058fa49
import
NextApp
from
'next/app'
import
{
CacheProvider
}
from
'@emotion/core'
// Use only { cache } from 'emotion'. Don't use { css }.
import
{
cache
}
from
'emotion'
import
{
globalStyles
}
from
'../shared/styles'
import
{
globalStyles
}
from
'../shared/styles'
export
default
class
App
extends
NextApp
{
const
App
=
({
Component
,
pageProps
})
=>
(
render
()
{
<>
const
{
Component
,
pageProps
}
=
this
.
props
return
(
<
CacheProvider
value
=
{
cache
}
>
{
globalStyles
}
{
globalStyles
}
<
Component
{...
pageProps
}
/
>
<
Component
{...
pageProps
}
/
>
<
/CacheProvider
>
<
/
>
)
)
}
}
export
default
App
examples/with-emotion/pages/_document.js
deleted
100644 → 0
View file @
e20dba2c
import
Document
,
{
Html
,
Head
,
Main
,
NextScript
}
from
'next/document'
import
{
extractCritical
}
from
'emotion-server'
export
default
class
MyDocument
extends
Document
{
static
async
getInitialProps
(
ctx
)
{
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
const
styles
=
extractCritical
(
initialProps
.
html
)
return
{
...
initialProps
,
styles
:
(
<>
{
initialProps
.
styles
}
<
style
data
-
emotion
-
css
=
{
styles
.
ids
.
join
(
' '
)}
dangerouslySetInnerHTML
=
{{
__html
:
styles
.
css
}}
/
>
<
/
>
),
}
}
render
()
{
return
(
<
Html
>
<
Head
/>
<
body
>
<
Main
/>
<
NextScript
/>
<
/body
>
<
/Html
>
)
}
}
examples/with-emotion/pages/index.js
View file @
e058fa49
import
{
Basic
,
Combined
,
Animated
,
bounce
}
from
'../shared/styles'
import
{
Animated
,
Basic
,
bounce
,
Combined
}
from
'../shared/styles'
const
Home
=
()
=>
(
const
Home
=
()
=>
(
<
div
>
<
div
>
<
Basic
>
Cool
Styles
<
/Basic
>
<
Basic
>
Cool
Styles
<
/Basic
>
...
...
examples/with-emotion/shared/styles.js
View file @
e058fa49
import
{
keyframes
,
css
,
Global
}
from
'@emotion/core'
import
{
css
,
Global
,
keyframes
}
from
'@emotion/core'
import
styled
from
'@emotion/styled'
import
styled
from
'@emotion/styled'
export
const
globalStyles
=
(
export
const
globalStyles
=
(
...
@@ -46,22 +46,22 @@ export const bounce = keyframes`
...
@@ -46,22 +46,22 @@ export const bounce = keyframes`
}
}
`
`
export
const
Basic
=
styled
(
'div'
)
`
export
const
Basic
=
styled
.
div
`
${
basicStyles
}
;
${
basicStyles
}
;
`
`
export
const
Combined
=
styled
(
'div'
)
`
export
const
Combined
=
styled
.
div
`
${
basicStyles
}
;
${
basicStyles
}
;
${
hoverStyles
}
;
${
hoverStyles
}
;
& code {
& code {
background-color: linen;
background-color: linen;
}
}
`
`
export
const
Animated
=
styled
(
'div'
)
`
export
const
Animated
=
styled
.
div
`
${
basicStyles
}
;
${
basicStyles
}
;
${
hoverStyles
}
;
${
hoverStyles
}
;
& code {
& code {
background-color: linen;
background-color: linen;
}
}
animation:
${(
props
)
=>
props
.
animation
}
0.2s infinite ease-in-out alternate;
animation:
${(
{
animation
})
=>
animation
}
0.2s infinite ease-in-out alternate;
`
`
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