Skip to content

Commit d3c21b7

Browse files
Laurie BarthLaurie Barth
authored andcommitted
rename to preset
1 parent 2cb248e commit d3c21b7

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

packages/gatsby-plugin-theme-ui/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ prevent a flash of unstyled colors when using color modes.
2020

2121
| Key | Default value | Description |
2222
| ------------------------ | ---------------- | -------------------------------------------------------------------------------- |
23-
| `themePreset` | `null` | This can be a JSON theme object or a string package name. Make sure the package you're requiring is installed in your dependencies. |
23+
| `preset` | `null` | This can be a JSON theme object or a string package name. Make sure the package you're requiring is installed in your dependencies. |
2424

2525
> Note that this plugin assumes the theme object is exported as `default`.
2626

packages/gatsby-plugin-theme-ui/gatsby-node.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
exports.onPreInit = (__, options) => {
2-
let { themePreset } = options
2+
let { preset } = options
33

4-
if (typeof themePreset === 'string') {
4+
if (typeof preset === 'string') {
55
try {
6-
options.themePreset = require(themePreset)
6+
options.preset = require(preset)
77
} catch {
88
reporter.error(
99
`It appears your theme dependency is not installed. Try running \`${generateInstallInstructions()} ${themeModule}\``
@@ -28,19 +28,16 @@ exports.createSchemaCustomization = ({ actions }) => {
2828

2929
createTypes(`
3030
type ThemeUiConfig implements Node {
31-
themePreset: JSON,
31+
preset: JSON,
3232
}
3333
`)
3434
}
3535

36-
exports.sourceNodes = (
37-
{ actions, createContentDigest },
38-
{ themePreset = {} }
39-
) => {
36+
exports.sourceNodes = ({ actions, createContentDigest }, { preset = {} }) => {
4037
const { createNode } = actions
4138

4239
const themeUiConfig = {
43-
themePreset,
40+
preset,
4441
}
4542

4643
createNode({

packages/gatsby-plugin-theme-ui/src/hooks/configOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const useThemeUiConfig = () => {
44
const data = useStaticQuery(graphql`
55
query {
66
themeUiConfig(id: { eq: "gatsby-plugin-theme-ui-config" }) {
7-
themePreset
7+
preset
88
}
99
}
1010
`)

packages/gatsby-plugin-theme-ui/src/provider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/** @jsx jsx */
22
import { jsx, ThemeProvider, merge } from 'theme-ui'
3-
import theme from './index'
3+
import localTheme from './index'
44
import components from './components'
55
import useThemeUiConfig from './hooks/configOptions'
66

77
const Root = ({ children }) => {
88
const themeUiConfig = useThemeUiConfig()
9-
const { themePreset } = themeUiConfig
9+
const { preset } = themeUiConfig
1010

11-
const theme = themePreset.default || themePreset
11+
const theme = preset.default || preset
1212

1313
const fullTheme = merge(theme, localTheme)
1414

0 commit comments

Comments
 (0)