Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit 3d7d8c1

Browse files
Kerumenrakannimer
authored andcommitted
style(gatsby-theme-docz): simplify the default config (#1203)
* style(gatsby-theme-docz): simplify the default config * improvements
1 parent 0bb83c9 commit 3d7d8c1

File tree

5 files changed

+8
-32
lines changed

5 files changed

+8
-32
lines changed

core/docz/src/components/Playground.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export interface PlaygroundProps {
1111
__position: number
1212
__code: string
1313
language?: string
14-
showLivePreview?: boolean
1514
}
1615

1716
export const Playground: SFC<PlaygroundProps> = ({
@@ -23,7 +22,6 @@ export const Playground: SFC<PlaygroundProps> = ({
2322
__position,
2423
__code,
2524
language,
26-
showLivePreview = true,
2725
}) => {
2826
const components = useComponents()
2927
const PlaygroundComponent = components.playground
@@ -39,7 +37,6 @@ export const Playground: SFC<PlaygroundProps> = ({
3937
scope={__scope}
4038
position={__position}
4139
code={__code}
42-
showLivePreview={showLivePreview}
4340
language={language}
4441
/>
4542
)

core/docz/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { Link, LinkProps } from './components/Link'
2-
export { Playground } from './components/Playground'
2+
export { Playground, PlaygroundProps } from './components/Playground'
33
export { Props, PropsComponentProps } from './components/Props'
44

55
export * from './hooks'

core/gatsby-theme-docz/src/components/Playground/index.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,9 @@ import { usePrismTheme } from '~utils/theme'
1010
import * as styles from './styles'
1111
import * as Icons from '../Icons'
1212

13-
export const Playground = ({
14-
code,
15-
scope,
16-
showLivePreview: userShowLivePreview = true,
17-
language,
18-
}) => {
13+
export const Playground = ({ code, scope, language }) => {
1914
const {
20-
themeConfig: {
21-
showPlaygroundEditor,
22-
showLiveError,
23-
showLivePreview = userShowLivePreview,
24-
},
15+
themeConfig: { showPlaygroundEditor, showLiveError, showLivePreview },
2516
} = useConfig()
2617

2718
const theme = usePrismTheme()

core/gatsby-theme-docz/src/index.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,4 @@ const Theme = ({ children }) => {
1717
)
1818
}
1919

20-
export const enhance = theme(
21-
defaultTheme,
22-
({
23-
mode = 'light',
24-
showPlaygroundEditor = true,
25-
showLiveError = true,
26-
...config
27-
}) => ({
28-
...config,
29-
showLiveError,
30-
showPlaygroundEditor,
31-
initialColorMode: mode,
32-
})
33-
)
34-
35-
export default enhance(Theme)
20+
export default theme(defaultTheme)(Theme)

core/gatsby-theme-docz/src/theme/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ moraga.headerWeight = 700
1010
const typography = toTheme(moraga)
1111

1212
export default merge(typography, {
13-
prism,
1413
initialColorMode: 'light',
14+
showLiveError: true,
15+
showLivePreview: true,
16+
showPlaygroundEditor: true,
1517
colors: {
1618
...modes.light,
1719
modes: {
@@ -42,4 +44,5 @@ export default merge(typography, {
4244
rounded: 10,
4345
},
4446
styles,
47+
prism,
4548
})

0 commit comments

Comments
 (0)