Make toolbar just be a aesthetic component

main
Mike Fix 7 years ago
parent 8783aa55a0
commit 36800e763c

@ -1,23 +1,7 @@
import React from 'react' import React from 'react'
import Dropdown from './Dropdown'
import ColorPicker from './ColorPicker'
import Settings from './Settings'
import Button from './Button'
import { THEMES, LANGUAGES } from '../lib/constants'
const Toolbar = (props) => ( const Toolbar = (props) => (
<div id="toolbar"> <div id="toolbar">
<Dropdown list={THEMES} onChange={props.onThemeChange}/> {props.children}
<Dropdown list={LANGUAGES} onChange={props.onLanguageChange}/>
<ColorPicker
onChange={props.onBGChange}
bg={props.bg}
/>
<Settings onChange={props.onSettingsChange} enabled={props.enabled} />
<div className="buttons">
<Button className="tweetButton" onClick={props.upload} title={props.uploading ? 'Loading...' : 'Tweet Image'} color="#57b5f9" style={{ marginRight: '8px' }} />
<Button onClick={props.save} title="Save Image" color="#c198fb" />
</div>
<style jsx>{` <style jsx>{`
#toolbar { #toolbar {
width: 100%; width: 100%;

@ -1,15 +1,27 @@
// Theirs
import React from 'react' import React from 'react'
import HTML5Backend from 'react-dnd-html5-backend' import HTML5Backend from 'react-dnd-html5-backend'
import { DragDropContext } from 'react-dnd' import { DragDropContext } from 'react-dnd'
import domtoimage from 'dom-to-image' import domtoimage from 'dom-to-image'
// Ours
import Page from '../components/Page' import Page from '../components/Page'
import ReadFileDropContainer from '../components/ReadFileDropContainer' import ReadFileDropContainer from '../components/ReadFileDropContainer'
import Button from '../components/Button'
import Dropdown from '../components/Dropdown'
import ColorPicker from '../components/ColorPicker'
import Settings from '../components/Settings'
import Toolbar from '../components/Toolbar' import Toolbar from '../components/Toolbar'
import Overlay from '../components/Overlay' import Overlay from '../components/Overlay'
import Carbon from '../components/Carbon' import Carbon from '../components/Carbon'
import api from '../lib/api' import api from '../lib/api'
import { THEMES, DEFAULT_LANGUAGE, COLORS, DEFAULT_CODE } from '../lib/constants' import {
THEMES,
LANGUAGES,
DEFAULT_LANGUAGE,
COLORS,
DEFAULT_CODE
} from '../lib/constants'
class Editor extends React.Component { class Editor extends React.Component {
/* pathname, asPath, err, req, res */ /* pathname, asPath, err, req, res */
@ -88,20 +100,27 @@ class Editor extends React.Component {
return ( return (
<Page enableHeroText> <Page enableHeroText>
<div id="editor"> <div id="editor">
<Toolbar <Toolbar>
save={this.save} <Dropdown list={THEMES} onChange={theme => this.setState({ theme: theme.id })}/>
upload={this.upload} <Dropdown list={LANGUAGES} onChange={language => this.setState({ language: language.module })}/>
uploading={this.state.uploading} <ColorPicker
onBGChange={color => this.setState({ background: color })} onChange={color => this.setState({ background: color })}
onThemeChange={theme => this.setState({ theme: theme.id })} bg={this.state.background}
onLanguageChange={language => this.setState({ language: language.module })} />
onSettingsChange={(key, value) => this.setState({ [key]: value })} <Settings onChange={(key, value) => this.setState({ [key]: value })} enabled={this.state} />
bg={this.state.background} <div className="buttons">
enabled={this.state} <Button
/> className="tweetButton"
<ReadFileDropContainer onClick={this.upload}
onDrop={droppedContent => this.setState({ code: droppedContent })} title={this.state.uploading ? 'Loading...' : 'Tweet Image'}
> color="#57b5f9"
style={{ marginRight: '8px' }}
/>
<Button onClick={this.save} title="Save Image" color="#c198fb" />
</div>
</Toolbar>
<ReadFileDropContainer onDrop={droppedContent => this.setState({ code: droppedContent })}>
<Overlay title="Drop your file here to import"> <Overlay title="Drop your file here to import">
<Carbon config={this.state} updateCode={this.updateCode}> <Carbon config={this.state} updateCode={this.updateCode}>
{this.state.code} {this.state.code}

Loading…
Cancel
Save