From 7dac7ae15c8d9a1df86e680d3a28e8a5ae33b748 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Sun, 9 Jul 2017 15:21:37 -0700 Subject: [PATCH] Add dnd container (doesn't render?). Make top level settings single source of truth --- components/CodeImage.js | 5 ----- components/Settings.js | 10 ++++++++-- components/Toolbar.js | 2 +- pages/index.js | 37 +++++++++++++++++++++++-------------- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/components/CodeImage.js b/components/CodeImage.js index c5cbfbf..db1fd71 100644 --- a/components/CodeImage.js +++ b/components/CodeImage.js @@ -5,11 +5,6 @@ import CodeMirror from 'react-codemirror' import WindowControls from '../components/svg/Controls' import Spinner from 'react-spinner' -// hack to only call modes on browser -if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { - require('../lib/constants') -} - const DEFAULT_SETTINGS = { paddingVertical: '50px', paddingHorizontal: '50px', diff --git a/components/Settings.js b/components/Settings.js index 02d8be2..849aca3 100644 --- a/components/Settings.js +++ b/components/Settings.js @@ -31,8 +31,14 @@ class Settings extends React.Component {
- - + +
diff --git a/components/Toolbar.js b/components/Toolbar.js index 0ab1085..aff3c46 100644 --- a/components/Toolbar.js +++ b/components/Toolbar.js @@ -14,7 +14,7 @@ const Toolbar = (props) => ( onChange={props.onBGChange} bg={props.bg} /> - +
-
- this.setState({ background: color })} - onThemeChange={theme => this.setState({ theme: theme.id })} - onLanguageChange={language => this.setState({ language })} - onSettingsChange={(key, value) => this.setState({ [key]: value })} - bg={this.state.background} - /> - - {this.droppedContent || this.props.content || DEFAULT_CODE} - -
+ { + console.log(droppedContent) + this.setState({ droppedContent }) + }} + > +
+ this.setState({ background: color })} + onThemeChange={theme => this.setState({ theme: theme.id })} + onLanguageChange={language => this.setState({ language })} + onSettingsChange={(key, value) => this.setState({ [key]: value })} + bg={this.state.background} + enabled={this.state} + /> + + {this.state.droppedContent || this.props.content || DEFAULT_CODE} + +
+
a project by @dawn_labs ¬