mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Update emotion examples with new API for SSR and React endpoint (#2456)
* Update emotion examples with new API for SSR and React endpoint * Actually fixing tab replacement
This commit is contained in:
parent
5a840cc39e
commit
0f3fecfe8b
|
@ -7,7 +7,7 @@
|
|||
"start": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
"emotion": "^4.1.2",
|
||||
"emotion": "^5.0.0",
|
||||
"next": "^2.4.6",
|
||||
"react": "^15.6.1",
|
||||
"react-dom": "^15.6.1"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import Document, { Head, Main, NextScript } from 'next/document'
|
||||
import { renderStaticOptimized } from 'emotion/server'
|
||||
import { extractCritical } from 'emotion/server'
|
||||
|
||||
export default class MyDocument extends Document {
|
||||
static getInitialProps ({ renderPage }) {
|
||||
const page = renderPage()
|
||||
const styles = renderStaticOptimized(() => page.html)
|
||||
const styles = extractCritical(page.html)
|
||||
return { ...page, ...styles }
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react'
|
||||
import { hydrate, keyframes, fragment, injectGlobal } from 'emotion'
|
||||
import styled from 'emotion/styled'
|
||||
import styled from 'emotion/react'
|
||||
|
||||
// Adds server generated styles to emotion cache.
|
||||
// '__NEXT_DATA__.ids' is set in '_document.js'
|
||||
|
@ -69,15 +69,11 @@ export default () => {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<Basic>
|
||||
Cool Styles
|
||||
</Basic>
|
||||
<Basic>Cool Styles</Basic>
|
||||
<Combined>
|
||||
With <code>:hover</code>.
|
||||
</Combined>
|
||||
<Animated animation={bounce}>
|
||||
Let's bounce.
|
||||
</Animated>
|
||||
<Animated animation={bounce}>Let's bounce.</Animated>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue