Skip to content

Commit

Permalink
remove unneeded deps & updated example (#17651)
Browse files Browse the repository at this point in the history
Closes #17626
  • Loading branch information
JipSterk authored Oct 29, 2020
1 parent e20dba2 commit e058fa4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 59 deletions.
3 changes: 3 additions & 0 deletions examples/with-emotion/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["next/babel", "@emotion/babel-preset-css-prop"]
}
7 changes: 4 additions & 3 deletions examples/with-emotion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
"keywords": [],
"author": "Thomas Greco",
"license": "MIT",
"devDependencies": {
"@emotion/babel-preset-css-prop": "10.0.27"
},
"dependencies": {
"@emotion/core": "10.0.27",
"@emotion/core": "10.0.35",
"@emotion/styled": "10.0.27",
"emotion": "10.0.27",
"emotion-server": "10.0.27",
"next": "latest",
"react": "^16.7.0",
"react-dom": "^16.7.0"
Expand Down
25 changes: 8 additions & 17 deletions examples/with-emotion/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
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'

export default class App extends NextApp {
render() {
const { Component, pageProps } = this.props
return (
<CacheProvider value={cache}>
{globalStyles}
<Component {...pageProps} />
</CacheProvider>
)
}
}
const App = ({ Component, pageProps }) => (
<>
{globalStyles}
<Component {...pageProps} />
</>
)

export default App
33 changes: 0 additions & 33 deletions examples/with-emotion/pages/_document.js

This file was deleted.

3 changes: 2 additions & 1 deletion examples/with-emotion/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Basic, Combined, Animated, bounce } from '../shared/styles'
import { Animated, Basic, bounce, Combined } from '../shared/styles'

const Home = () => (
<div>
<Basic>Cool Styles</Basic>
Expand Down
10 changes: 5 additions & 5 deletions examples/with-emotion/shared/styles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { keyframes, css, Global } from '@emotion/core'
import { css, Global, keyframes } from '@emotion/core'
import styled from '@emotion/styled'

export const globalStyles = (
Expand Down Expand Up @@ -46,22 +46,22 @@ export const bounce = keyframes`
}
`

export const Basic = styled('div')`
export const Basic = styled.div`
${basicStyles};
`

export const Combined = styled('div')`
export const Combined = styled.div`
${basicStyles};
${hoverStyles};
& code {
background-color: linen;
}
`
export const Animated = styled('div')`
export const Animated = styled.div`
${basicStyles};
${hoverStyles};
& code {
background-color: linen;
}
animation: ${(props) => props.animation} 0.2s infinite ease-in-out alternate;
animation: ${({ animation }) => animation} 0.2s infinite ease-in-out alternate;
`

0 comments on commit e058fa4

Please sign in to comment.