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
af1d10c9
Commit
af1d10c9
authored
Nov 29, 2018
by
Steven Bell
Committed by
Tim Neutkens
Nov 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update with-emotion example to emotion 10 (#5770)
parent
f1fe237b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
58 deletions
+20
-58
.babelrc
examples/with-emotion/.babelrc
+1
-1
package.json
examples/with-emotion/package.json
+5
-6
_document.js
examples/with-emotion/pages/_document.js
+0
-32
index.js
examples/with-emotion/pages/index.js
+14
-19
No files found.
examples/with-emotion/.babelrc
View file @
af1d10c9
...
@@ -3,6 +3,6 @@
...
@@ -3,6 +3,6 @@
"next/babel"
"next/babel"
],
],
"plugins": [
"plugins": [
["emotion"
, { "inline": true }
]
["emotion"]
]
]
}
}
\ No newline at end of file
examples/with-emotion/package.json
View file @
af1d10c9
...
@@ -7,13 +7,12 @@
...
@@ -7,13 +7,12 @@
"start"
:
"next start"
"start"
:
"next start"
},
},
"dependencies"
:
{
"dependencies"
:
{
"
babel-plugin-emotion"
:
"^8.0.4
"
,
"
@emotion/core"
:
"^10.0.0
"
,
"
emotion"
:
"^8.0.5
"
,
"
@emotion/styled"
:
"^10.0.0
"
,
"
emotion-server"
:
"^8.0.5
"
,
"
babel-plugin-emotion"
:
"^10.0.0
"
,
"next"
:
"latest"
,
"next"
:
"latest"
,
"react"
:
"16.2.0"
,
"react"
:
"^16.3.0"
,
"react-dom"
:
"16.2.0"
,
"react-dom"
:
"^16.3.0"
"react-emotion"
:
"^8.0.5"
},
},
"license"
:
"ISC"
"license"
:
"ISC"
}
}
examples/with-emotion/pages/_document.js
deleted
100644 → 0
View file @
f1fe237b
import
Document
,
{
Head
,
Main
,
NextScript
}
from
'next/document'
import
{
extractCritical
}
from
'emotion-server'
export
default
class
MyDocument
extends
Document
{
static
getInitialProps
({
renderPage
})
{
const
page
=
renderPage
()
const
styles
=
extractCritical
(
page
.
html
)
return
{
...
page
,
...
styles
}
}
constructor
(
props
)
{
super
(
props
)
const
{
__NEXT_DATA__
,
ids
}
=
props
if
(
ids
)
{
__NEXT_DATA__
.
ids
=
ids
}
}
render
()
{
return
(
<
html
>
<
Head
>
<
style
dangerouslySetInnerHTML
=
{{
__html
:
this
.
props
.
css
}}
/
>
<
/Head
>
<
body
>
<
Main
/>
<
NextScript
/>
<
/body
>
<
/html
>
)
}
}
examples/with-emotion/pages/index.js
View file @
af1d10c9
import
React
from
'react'
import
React
from
'react'
import
Head
from
'next/head'
import
Head
from
'next/head'
import
styled
,
{
hydrate
,
keyframes
,
css
,
injectGlobal
}
from
'react-emotion'
import
styled
from
'@emotion/styled'
import
{
keyframes
,
css
,
Global
}
from
'@emotion/core'
// Adds server generated styles to emotion cache.
// '__NEXT_DATA__.ids' is set in '_document.js'
if
(
typeof
window
!==
'undefined'
)
{
hydrate
(
window
.
__NEXT_DATA__
.
ids
)
}
injectGlobal
`
html, body {
padding: 3rem 1rem;
margin: 0;
background: papayawhip;
min-height: 100%;
font-family: Helvetica, Arial, sans-serif;
font-size: 24px;
}
`
const
basicStyles
=
css
`
const
basicStyles
=
css
`
background-color: white;
background-color: white;
...
@@ -69,7 +53,18 @@ const Animated = styled.div`
...
@@ -69,7 +53,18 @@ const Animated = styled.div`
export
default
()
=>
{
export
default
()
=>
{
return
(
return
(
<>
' '
<
Head
>
<>
' '
<
Global
styles
=
{
css
`
html, body {
padding: 3rem 1rem;
margin: 0;
background: papayawhip;
min-height: 100%;
font-family: Helvetica, Arial, sans-serif;
font-size: 24px;
}
`
}
/>' '<Head
>
<
title
>
With
Emotion
<
/title
>
<
title
>
With
Emotion
<
/title
>
<
/Head>' '<div
>
<
/Head>' '<div
>
<
Basic
>
Cool
Styles
<
/Basic
>
<
Basic
>
Cool
Styles
<
/Basic
>
...
...
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