From 4ebc143ed87852ba20c0392898e0363c1e3eb345 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sun, 18 Dec 2016 17:28:59 +0100 Subject: [PATCH] Icons for layer types --- src/fields/color.jsx | 2 +- src/icons/background.jsx | 15 +++++++++++++++ src/icons/fill.jsx | 15 +++++++++++++++ src/icons/layer.jsx | 35 +++++++++++++++++++++++++++++++++++ src/icons/line.jsx | 15 +++++++++++++++ src/icons/symbol.jsx | 18 ++++++++++++++++++ src/layers/list.jsx | 3 ++- src/layers/listitem.jsx | 20 ++++++++++++++++---- src/scrollcontainer.jsx | 1 - 9 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 src/icons/background.jsx create mode 100644 src/icons/fill.jsx create mode 100644 src/icons/layer.jsx create mode 100644 src/icons/line.jsx create mode 100644 src/icons/symbol.jsx diff --git a/src/fields/color.jsx b/src/fields/color.jsx index 8cd477f5..77deaa80 100644 --- a/src/fields/color.jsx +++ b/src/fields/color.jsx @@ -35,7 +35,7 @@ class ColorField extends React.Component { left: 287 }}> this.props.onChange(formatColor(c))} />
+ + + ) + } +} + + diff --git a/src/icons/fill.jsx b/src/icons/fill.jsx new file mode 100644 index 00000000..718a43ae --- /dev/null +++ b/src/icons/fill.jsx @@ -0,0 +1,15 @@ +import React from 'react' +import IconBase from 'react-icon-base' + + +export default class FillIcon extends React.Component { + render() { + return ( + + + + ) + } +} + + diff --git a/src/icons/layer.jsx b/src/icons/layer.jsx new file mode 100644 index 00000000..72d51e6c --- /dev/null +++ b/src/icons/layer.jsx @@ -0,0 +1,35 @@ +import React from 'react' + +import LineIcon from './line.jsx' +import FillIcon from './fill.jsx' +import SymbolIcon from './symbol.jsx' +import BackgroundIcon from './background.jsx' + +class LayerIcon extends React.Component { + static propTypes = { + type: React.PropTypes.string.isRequired, + style: React.PropTypes.object, + } + + render() { + if (this.props.type === "fill") { + return + } + + if (this.props.type === "background") { + return + } + + if (this.props.type === "line") { + return + } + + if (this.props.type === "symbol") { + return + } + + return null + } +} + +export default LayerIcon diff --git a/src/icons/line.jsx b/src/icons/line.jsx new file mode 100644 index 00000000..ab5acbdc --- /dev/null +++ b/src/icons/line.jsx @@ -0,0 +1,15 @@ +import React from 'react' +import IconBase from 'react-icon-base' + + +export default class FillIcon extends React.Component { + render() { + return ( + + + + ) + } +} + + diff --git a/src/icons/symbol.jsx b/src/icons/symbol.jsx new file mode 100644 index 00000000..941d9b97 --- /dev/null +++ b/src/icons/symbol.jsx @@ -0,0 +1,18 @@ +import React from 'react' +import IconBase from 'react-icon-base' + + +export default class SymbolIcon extends React.Component { + render() { + return ( + + + + + + ) + } +} + + + diff --git a/src/layers/list.jsx b/src/layers/list.jsx index 605e905b..d3c0fc6a 100644 --- a/src/layers/list.jsx +++ b/src/layers/list.jsx @@ -50,11 +50,12 @@ class LayerListContainer extends React.Component { index={index} key={layerId} layerId={layerId} + layerType={layer.get('type')} onLayerSelected={this.props.onLayerSelected} /> }) return -
    +
      {layerPanels}
    diff --git a/src/layers/listitem.jsx b/src/layers/listitem.jsx index c4ee3d67..8d4cee2e 100644 --- a/src/layers/listitem.jsx +++ b/src/layers/listitem.jsx @@ -8,20 +8,32 @@ import Toolbar from 'rebass/dist/Toolbar' import NavItem from 'rebass/dist/NavItem' import Space from 'rebass/dist/Space' +import LayerIcon from '../icons/layer.jsx' import { LayerEditor } from './editor.jsx' import scrollbars from '../scrollbars.scss' import PureRenderMixin from 'react-addons-pure-render-mixin'; import theme from '../theme.js' import {SortableElement, SortableHandle} from 'react-sortable-hoc'; -import MdDragHandle from 'react-icons/lib/md/drag-handle' -const DragHandle = SortableHandle(() => ); + +@SortableHandle +class LayerTypeDragHandle extends React.Component { + static propTypes = LayerIcon.propTypes + + render() { + return + } +} @SortableElement @Radium class LayerListItem extends React.Component { static propTypes = { layerId: React.PropTypes.string.isRequired, + layerType: React.PropTypes.string.isRequired, onLayerSelected: React.PropTypes.func.isRequired, } @@ -54,8 +66,8 @@ class LayerListItem extends React.Component { backgroundColor: color(theme.colors.gray).lighten(0.15).hexString(), } }}> - - #{this.props.layerId} + + {this.props.layerId} } } diff --git a/src/scrollcontainer.jsx b/src/scrollcontainer.jsx index 8c06cc8d..f8b64665 100644 --- a/src/scrollcontainer.jsx +++ b/src/scrollcontainer.jsx @@ -10,7 +10,6 @@ const ScrollContainer = (props) => { right:0, top:1, position: "absolute", - padding: theme.scale[2], }}> {props.children}