Commit 573692c1 authored by Hugo Meissner's avatar Hugo Meissner Committed by Tim Neutkens

emotion v8 + adjustments for breaking changes (#3054)

* emotion v8 + adjustments for breaking changes

* Corrected versioning

* Take hydrate from 'react-emotion'

I was actually wondering that, but haven't seen hydrate in the medium post (even though you pointed out that react-emotion exports all of emotion and I've seen it in source) and didn't want to risk it for the off chance that it *should* be imported directly from emotion for some reason :D
parent 7fe20ed2
......@@ -7,13 +7,13 @@
"start": "next start"
},
"dependencies": {
"babel-plugin-emotion": "^7.1.0",
"emotion": "^7.2.0",
"emotion-server": "^7.2.0",
"babel-plugin-emotion": "^8.0.4",
"emotion": "^8.0.5",
"emotion-server": "^8.0.5",
"next": "^3.0.6",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-emotion": "^7.2.0"
"react-emotion": "^8.0.5"
},
"license": "ISC"
}
import Document, { Head, Main, NextScript } from 'next/document'
import { extractCritical } from 'emotion-server'
import { flush } from 'emotion'
const dev = process.env.NODE_ENV !== 'production'
export default class MyDocument extends Document {
static getInitialProps ({ renderPage }) {
if (dev) { flush() }
const page = renderPage()
const styles = extractCritical(page.html)
return { ...page, ...styles }
......
import React from 'react'
import { hydrate, keyframes, css, injectGlobal } from 'emotion'
import styled from 'react-emotion'
import styled, { hydrate, keyframes, css, injectGlobal } from 'react-emotion'
// Adds server generated styles to emotion cache.
// '__NEXT_DATA__.ids' is set in '_document.js'
......@@ -48,15 +47,20 @@ export default () => {
}
`
const Basic = styled.div`composes: ${basicStyles};`
const Basic = styled.div`
${basicStyles};
`
const Combined = styled.div`
composes: ${basicStyles} ${hoverStyles};
${basicStyles};
${hoverStyles};
& code {
background-color: linen;
}
`
const Animated = styled.div`
composes: ${basicStyles} ${hoverStyles};
${basicStyles};
${hoverStyles};
& code {
background-color: linen;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment