Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Commit

Permalink
feat(gatsby-theme-docz): add showLiveError on Playground
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jul 11, 2019
1 parent f823cc6 commit e593897
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/gatsby-theme-docz/src/components/Playground/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as Icons from '../Icons'

export const Playground = ({ code, scope }) => {
const {
themeConfig: { showPlaygroundEditor },
themeConfig: { showPlaygroundEditor, showLiveError },
} = useConfig()

const [showingCode, setShowingCode] = useState(() => showPlaygroundEditor)
Expand Down Expand Up @@ -51,7 +51,7 @@ export const Playground = ({ code, scope }) => {
</button>
</div>
</div>
<LiveError sx={styles.error} />
{showLiveError && <LiveError sx={styles.error} />}
{showingCode && (
<div sx={styles.editor(theme)}>
<LiveEditor />
Expand Down
8 changes: 7 additions & 1 deletion core/gatsby-theme-docz/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ const Theme = ({ children }) => {

export const enhance = theme(
defaultTheme,
({ mode = 'light', showPlaygroundEditor = true, ...config }) => ({
({
mode = 'light',
showPlaygroundEditor = true,
showLiveError = true,
...config
}) => ({
...config,
showLiveError,
showPlaygroundEditor,
initialColorMode: mode,
})
Expand Down

0 comments on commit e593897

Please sign in to comment.