From e5938976bd28e1652445d02861053affc9563708 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Thu, 11 Jul 2019 08:33:52 -0300 Subject: [PATCH] feat(gatsby-theme-docz): add showLiveError on Playground --- core/gatsby-theme-docz/src/components/Playground/index.js | 4 ++-- core/gatsby-theme-docz/src/index.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/gatsby-theme-docz/src/components/Playground/index.js b/core/gatsby-theme-docz/src/components/Playground/index.js index 900113de4..7685a7996 100644 --- a/core/gatsby-theme-docz/src/components/Playground/index.js +++ b/core/gatsby-theme-docz/src/components/Playground/index.js @@ -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) @@ -51,7 +51,7 @@ export const Playground = ({ code, scope }) => { - + {showLiveError && } {showingCode && (
diff --git a/core/gatsby-theme-docz/src/index.js b/core/gatsby-theme-docz/src/index.js index 56c7cd6ed..51f54adc9 100644 --- a/core/gatsby-theme-docz/src/index.js +++ b/core/gatsby-theme-docz/src/index.js @@ -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, })