File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed
packages/gatsby-plugin-theme-ui/src Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change 1
1
/** @jsx jsx */
2
- import {
3
- jsx ,
4
- ThemeProvider ,
5
- merge
6
- } from 'theme-ui'
2
+ import { jsx , ThemeProvider , merge } from 'theme-ui'
7
3
import theme from './index'
8
4
import components from './components'
9
5
import useThemeUiConfig from './hooks/configOptions'
10
6
11
-
12
- const Root = ( { children} ) => {
7
+ const Root = ( { children } ) => {
13
8
const themeUiConfig = useThemeUiConfig ( )
14
- const { themeModule, themeModulePath, moduleExportName} = themeUiConfig
9
+ const { themeModule, themeModulePath, moduleExportName } = themeUiConfig
15
10
16
11
let themeWrapper
17
12
if ( themeModule ) {
@@ -21,25 +16,31 @@ const Root = ({children}) => {
21
16
if ( themeModulePath ) {
22
17
themeWrapper = themeModulePath
23
18
}
24
-
25
- if ( themeWrapper && ( moduleExportName in themeWrapper ) ) {
19
+
20
+ if ( themeWrapper && moduleExportName in themeWrapper ) {
26
21
themeWrapper = themeWrapper [ moduleExportName ]
27
22
}
28
23
24
+ if ( prismPreset ) {
25
+ themeWrapper = merge ( themeWrapper , {
26
+ styles : {
27
+ pre : {
28
+ ...prismPreset ,
29
+ } ,
30
+ } ,
31
+ } )
32
+ }
33
+
29
34
themeWrapper = merge ( themeWrapper , {
30
- prism : prismPreset ,
31
- ...theme
35
+ ...theme ,
32
36
} )
33
37
return (
34
38
< ThemeProvider theme = { themeWrapper } components = { components } >
35
- { children }
39
+ { children }
36
40
</ ThemeProvider >
37
41
)
38
42
}
39
43
40
44
export const wrapRootElement = ( { element } ) => {
41
- return (
42
- < Root > { element } </ Root >
43
- )
45
+ return < Root > { element } </ Root >
44
46
}
45
-
You can’t perform that action at this time.
0 commit comments