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
5bd3a5f1
Commit
5bd3a5f1
authored
Jul 07, 2017
by
Josh Hawkins
Committed by
Tim Neutkens
Jul 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update emotion example to use css instead of fragment (#2497)
parent
df1cd7eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
16 deletions
+12
-16
package.json
examples/with-emotion/package.json
+1
-1
index.js
examples/with-emotion/pages/index.js
+11
-15
No files found.
examples/with-emotion/package.json
View file @
5bd3a5f1
...
...
@@ -7,7 +7,7 @@
"start"
:
"next start"
},
"dependencies"
:
{
"emotion"
:
"^5.
0.0
"
,
"emotion"
:
"^5.
1.4
"
,
"next"
:
"^2.4.6"
,
"react"
:
"^15.6.1"
,
"react-dom"
:
"^15.6.1"
...
...
examples/with-emotion/pages/index.js
View file @
5bd3a5f1
import
React
from
'react'
import
{
hydrate
,
keyframes
,
fragment
,
injectGlobal
}
from
'emotion'
import
{
hydrate
,
keyframes
,
css
,
injectGlobal
}
from
'emotion'
import
styled
from
'emotion/react'
// Adds server generated styles to emotion cache.
...
...
@@ -20,7 +20,7 @@ export default () => {
}
`
const
basicStyles
=
fragment
`
const
basicStyles
=
css
`
background-color: white;
color: cornflowerblue;
border: 1px solid lightgreen;
...
...
@@ -31,11 +31,13 @@ export default () => {
margin: 3rem 0;
padding: 1rem 0.5rem;
`
const
hoverStyles
=
fragment
`
color: white;
background-color: lightgray;
border-color: aqua;
box-shadow: -15px -15px 0 0 aqua, -30px -30px 0 0 cornflowerblue;
const
hoverStyles
=
css
`
&:hover {
color: white;
background-color: lightgray;
border-color: aqua;
box-shadow: -15px -15px 0 0 aqua, -30px -30px 0 0 cornflowerblue;
}
`
const
bounce
=
keyframes
`
from {
...
...
@@ -48,19 +50,13 @@ export default () => {
const
Basic
=
styled
.
div
`@apply
${
basicStyles
}
;`
const
Combined
=
styled
.
div
`
@apply
${
basicStyles
}
;
&:hover {
@apply
${
hoverStyles
}
;
}
composes:
${
basicStyles
}
${
hoverStyles
}
;
& code {
background-color: linen;
}
`
const
Animated
=
styled
.
div
`
@apply
${
basicStyles
}
;
&:hover {
@apply
${
hoverStyles
}
;
}
composes:
${
basicStyles
}
${
hoverStyles
}
;
& code {
background-color: linen;
}
...
...
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