Skip to content

Commit ce95a2d

Browse files
authored
fix(gatsby-plugin-theme-ui): Fast Refresh Compatibility (#1659)
1 parent 0fde1b4 commit ce95a2d

File tree

39 files changed

+151
-45
lines changed

39 files changed

+151
-45
lines changed

examples/custom-pragma/gatsby-browser.js

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { wrapRootElement } from './src'
1+
import * as React from 'react'
2+
import { WrapRootElement } from './src'
3+
4+
export const wrapRootElement = ({ element }) => (
5+
<WrapRootElement element={element} />
6+
)

examples/custom-pragma/gatsby-ssr.js

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { wrapRootElement } from './src'
1+
import * as React from 'react'
2+
import { WrapRootElement } from './src'
3+
4+
export const wrapRootElement = ({ element }) => (
5+
<WrapRootElement element={element} />
6+
)

examples/custom-pragma/src/index.js

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { ThemeProvider, Themed } from 'theme-ui'
33
import theme from './theme'
44

5-
export const wrapRootElement = ({ element }) => (
5+
export const WrapRootElement = ({ element }) => (
66
<ThemeProvider theme={theme}>
77
<Themed.root>{element}</Themed.root>
88
</ThemeProvider>

examples/dark-mode/gatsby-browser.js

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { wrapRootElement } from './src'
1+
import * as React from 'react'
2+
import { WrapRootElement } from './src'
3+
4+
export const wrapRootElement = ({ element }) => (
5+
<WrapRootElement element={element} />
6+
)

examples/dark-mode/gatsby-ssr.js

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { wrapRootElement } from './src'
1+
import * as React from 'react'
2+
import { WrapRootElement } from './src'
3+
4+
export const wrapRootElement = ({ element }) => (
5+
<WrapRootElement element={element} />
6+
)

examples/dark-mode/src/index.js

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { ThemeProvider, Themed } from 'theme-ui'
33
import theme from './theme'
44

5-
export const wrapRootElement = ({ element }) => (
5+
export const WrapRootElement = ({ element }) => (
66
<ThemeProvider theme={theme}>
77
<Themed.root>{element}</Themed.root>
88
</ThemeProvider>

examples/dark-mode/src/layout.js

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { jsx, useColorMode, Layout, Header, Main, Container } from 'theme-ui'
33
import { Global } from '@emotion/react'
44

5-
export default (props) => {
5+
const Layout = (props) => {
66
const [mode, setMode] = useColorMode()
77
const toggleMode = (e) => {
88
setMode(mode === 'dark' ? 'light' : 'dark')
@@ -31,3 +31,5 @@ export default (props) => {
3131
</Layout>
3232
)
3333
}
34+
35+
export default Layout

examples/dark-mode/src/theme.js

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
const theme = {
22
colors: {
33
text: '#000',
44
background: '#fff',
@@ -39,3 +39,5 @@ export default {
3939
},
4040
},
4141
}
42+
43+
export default theme

examples/gatsby-plugin/src/gatsby-plugin-theme-ui/index.js

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
const theme = {
22
useCustomProperties: true,
33
initialColorMode: 'light',
44
colors: {
@@ -37,3 +37,5 @@ export default {
3737
},
3838
},
3939
}
40+
41+
export default theme

examples/gatsby-plugin/src/layout.js

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @jsx jsx */
22
import { jsx, Themed } from 'theme-ui'
33

4-
export default (props) => (
4+
const Layout = (props) => (
55
<Themed.root>
66
<header>
77
<h2>Theme UI Gatsby Example</h2>
@@ -11,3 +11,5 @@ export default (props) => (
1111
</main>
1212
</Themed.root>
1313
)
14+
15+
export default Layout

0 commit comments

Comments
 (0)