Add save as dropdown (needs reconfiguring + style)

main
Mike Fix 7 years ago
parent 5abef2b4c3
commit 4e15b66001

@ -71,7 +71,7 @@ class Dropdown extends React.Component {
onClick={this.toggle} onClick={this.toggle}
> >
<div className={`dropdown-display ${this.state.isVisible ? 'is-visible' : ''}`}> <div className={`dropdown-display ${this.state.isVisible ? 'is-visible' : ''}`}>
<span>{this.props.selected.name}</span> <span style={{ minWidth: '4rem' }}>{this.props.selected.name}</span>
<div className="arrow-down"> <div className="arrow-down">
<ArrowDown /> <ArrowDown />
</div> </div>

@ -14,6 +14,7 @@ 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 ArrowDown from '../components/svg/Arrowdown'
import api from '../lib/api' import api from '../lib/api'
import { import {
THEMES, THEMES,
@ -75,6 +76,7 @@ class Editor extends React.Component {
paddingHorizontal: '32px', paddingHorizontal: '32px',
uploading: false, uploading: false,
code: props.content, code: props.content,
saveAs: 'png',
_initialState: this.props.initialState _initialState: this.props.initialState
}, },
this.props.initialState this.props.initialState
@ -190,15 +192,15 @@ class Editor extends React.Component {
style={{ marginRight: '8px' }} style={{ marginRight: '8px' }}
/> />
<Button <Button
onClick={e => this.save()} onClick={e => this.save({ format: this.state.saveAs })}
title="Save Image (PNG)" title="Save Image"
color="#c198fb" color="#c198fb"
style={{ marginRight: '8px' }} style={{ marginRight: '8px' }}
/> />
<Button <Dropdown
onClick={e => this.save({ format: 'svg' })} selected={{ id: this.state.saveAs, name: `(${this.state.saveAs.toUpperCase()})` }}
title="Save Vector (SVG)" list={['png', 'svg'].map(id => ({ id, name: id.toUpperCase() }))}
color="#9fca56" onChange={saveAs => this.setState({ saveAs: saveAs.id })}
/> />
</div> </div>
</Toolbar> </Toolbar>

Loading…
Cancel
Save