Skip to content

Commit

Permalink
fix(gatsby-theme-docz): add ssr support for styled-components
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Feb 27, 2019
1 parent 26f7f90 commit b490010
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions core/gatsby-theme-docz/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ module.exports = opts => {
{
resolve: 'gatsby-plugin-root-import',
},
{
resolve: 'gatsby-plugin-styled-components',
},
{
resolve: 'gatsby-plugin-compile-es6-packages',
options: {
Expand Down
2 changes: 2 additions & 0 deletions core/gatsby-theme-docz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"gatsby-plugin-manifest": "^2.0.19",
"gatsby-plugin-react-helmet": "^3.0.7",
"gatsby-plugin-root-import": "^2.0.5",
"gatsby-plugin-styled-components": "^3.0.6",
"lodash": "^4.17.11",
"prop-types": "^15.7.2",
"react": "^16.8.3",
Expand All @@ -39,6 +40,7 @@
"rehype-slug": "^2.0.2",
"remark-docz": "^0.13.3",
"remark-frontmatter": "^1.3.1",
"styled-components": "^4.1.3",
"ulid": "^2.3.0",
"yargs": "^13.2.1"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/gatsby/src/components/Alert.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import styled from '@emotion/styled'
import styled from 'styled-components'
import t from 'prop-types'

const kinds = {
Expand All @@ -9,7 +9,7 @@ const kinds = {
warning: '#FFA502',
}

const AlertStyled = styled('div')`
const AlertStyled = styled.div`
padding: 15px 20px;
background: white;
border-radius: 3px;
Expand Down
4 changes: 2 additions & 2 deletions examples/gatsby/src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import styled from '@emotion/styled'
import styled from 'styled-components'
import t from 'prop-types'

const scales = {
Expand Down Expand Up @@ -49,7 +49,7 @@ const kinds = outline => {
const getScale = ({ scale = 'normal' }) => scales[scale]
const getKind = ({ kind = 'primary', outline = false }) => kinds(outline)[kind]

const ButtonStyled = styled('button')`
const ButtonStyled = styled.button`
${getKind};
${getScale};
cursor: pointer;
Expand Down

0 comments on commit b490010

Please sign in to comment.