From 5b541354847e5ef798694d67f81bce90fce21c10 Mon Sep 17 00:00:00 2001 From: Dominic Coelho Date: Mon, 13 May 2019 17:37:58 +0100 Subject: [PATCH 1/2] handle optional theme.plain object, add storybook example --- src/components/Editor/index.js | 15 ++++++++++++++- stories/Live.js | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/components/Editor/index.js b/src/components/Editor/index.js index 4e425b26..a981d38a 100644 --- a/src/components/Editor/index.js +++ b/src/components/Editor/index.js @@ -55,9 +55,21 @@ class CodeEditor extends Component { ); render() { - const { style, code: _code, onChange, language, ...rest } = this.props; + const { + style, + code: _code, + onChange, + language, + theme, + ...rest + } = this.props; const { code } = this.state; + // const baseTheme = theme || liveTheme; + console.log(theme, 'theme!'); + const baseTheme = + theme && typeof theme.plain === 'object' ? theme.plain : {}; + return ( )) + .add('component with theme', () => ( + + + + + + )) .add('withLive example', () => ( From d04de574eb22c1a009722440af9e0acb86fa2d04 Mon Sep 17 00:00:00 2001 From: Dominic Coelho Date: Tue, 14 May 2019 11:06:54 +0100 Subject: [PATCH 2/2] remove console log and the commented out code --- src/components/Editor/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/Editor/index.js b/src/components/Editor/index.js index a981d38a..47aba9b3 100644 --- a/src/components/Editor/index.js +++ b/src/components/Editor/index.js @@ -65,8 +65,6 @@ class CodeEditor extends Component { } = this.props; const { code } = this.state; - // const baseTheme = theme || liveTheme; - console.log(theme, 'theme!'); const baseTheme = theme && typeof theme.plain === 'object' ? theme.plain : {};