Imrove layer list design

This commit is contained in:
Lukas Martinelli 2016-12-17 16:43:25 +01:00
parent dc8618cf3c
commit a91a1e99e0
8 changed files with 69 additions and 30 deletions

View file

@ -25,6 +25,7 @@
"mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae", "mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae",
"ol-mapbox-style": "0.0.11", "ol-mapbox-style": "0.0.11",
"openlayers": "^3.19.1", "openlayers": "^3.19.1",
"radium": "^0.18.1",
"randomcolor": "^0.4.4", "randomcolor": "^0.4.4",
"react": "^15.4.0", "react": "^15.4.0",
"react-addons-pure-render-mixin": "^15.4.0", "react-addons-pure-render-mixin": "^15.4.0",

View file

@ -123,7 +123,7 @@ export default class App extends React.Component {
top: 50, top: 50,
left: 0, left: 0,
zIndex: 100, zIndex: 100,
width: 200, width: 180,
overflow: "hidden", overflow: "hidden",
backgroundColor: colors.gray backgroundColor: colors.gray
}}> }}>
@ -136,7 +136,7 @@ export default class App extends React.Component {
<div style={{ <div style={{
...fullHeight, ...fullHeight,
top: 50, top: 50,
left: 200, left: 180,
zIndex: 100, zIndex: 100,
width: 300, width: 300,
overflow: "hidden", overflow: "hidden",

View file

@ -128,13 +128,6 @@ export class LayerEditor extends React.Component {
return <div style={{ return <div style={{
padding: theme.scale[0], padding: theme.scale[0],
borderBottom: 1,
borderTop: 1,
borderLeft: 2,
borderRight: 0,
borderStyle: "solid",
borderColor: theme.borderColor,
borderLeftColor: this.props.layer.getIn(['metadata', 'maputnik:color'])
}}> }}>
<Toolbar> <Toolbar>
<NavItem style={{fontWeight: 400}}> <NavItem style={{fontWeight: 400}}>

View file

@ -7,6 +7,7 @@ import NavItem from 'rebass/dist/NavItem'
import Space from 'rebass/dist/Space' import Space from 'rebass/dist/Space'
import { LayerEditor } from './editor.jsx' import { LayerEditor } from './editor.jsx'
import LayerListItem from './listitem.jsx'
import scrollbars from '../scrollbars.scss' import scrollbars from '../scrollbars.scss'
import PureRenderMixin from 'react-addons-pure-render-mixin'; import PureRenderMixin from 'react-addons-pure-render-mixin';
import theme from '../theme.js' import theme from '../theme.js'
@ -39,25 +40,13 @@ export class LayerList extends React.Component {
} }
render() { render() {
var layerPanels = [] const layerPanels = this.props.layers.map(layer => {
layerPanels = this.props.layers.map(layer => {
const layerId = layer.get('id') const layerId = layer.get('id')
return <div key={layerId} style={{ return <LayerListItem
padding: theme.scale[0], key={layerId}
borderBottom: 1, layerId={layerId}
borderTop: 1, onLayerSelected={this.props.onLayerSelected}
borderLeft: 2, />
borderRight: 0,
borderStyle: "solid",
borderColor: theme.borderColor
}}>
<Toolbar onClick={() => this.props.onLayerSelected(layerId)}>
<NavItem style={{fontWeight: 400}}>
#{layerId}
</NavItem>
<Space auto x={1} />
</Toolbar>
</div>
}).toIndexedSeq() }).toIndexedSeq()
return <div> return <div>

56
src/layers/listitem.jsx Normal file
View file

@ -0,0 +1,56 @@
import React from 'react'
import Radium from 'radium'
import Immutable from 'immutable'
import color from 'color'
import Heading from 'rebass/dist/Heading'
import Toolbar from 'rebass/dist/Toolbar'
import NavItem from 'rebass/dist/NavItem'
import Space from 'rebass/dist/Space'
import { LayerEditor } from './editor.jsx'
import scrollbars from '../scrollbars.scss'
import PureRenderMixin from 'react-addons-pure-render-mixin';
import theme from '../theme.js'
@Radium
class LayerListItem extends React.Component {
static propTypes = {
layerId: React.PropTypes.number.isRequired,
onLayerSelected: React.PropTypes.func.isRequired,
}
constructor(props) {
super(props)
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
}
render() {
return <div key={this.props.layerId} style={{
borderBottom: 1,
borderLeft: 2,
borderRight: 0,
borderStyle: "solid",
borderColor: color(theme.colors.gray).lighten(0.1).hexString(),
}}>
<div
onClick={() => this.props.onLayerSelected(this.props.layerId)}
style={{
backgroundColor: theme.colors.gray,
":hover": {
backgroundColor: color(theme.colors.gray).lighten(0.15).hexString(),
}
}}
>
<NavItem style={{
fontWeight: 400,
color: theme.colors.lowgray,
}}>
#{this.props.layerId}
</NavItem>
</div>
</div>
}
}
export default Radium(LayerListItem);

View file

@ -1,6 +1,6 @@
.darkScrollbar::-webkit-scrollbar { .darkScrollbar::-webkit-scrollbar {
background-color: #26282e; background-color: #26282e;
width: 10px; width: 5px;
} }
.darkScrollbar::-webkit-scrollbar-thumb { .darkScrollbar::-webkit-scrollbar-thumb {

View file

@ -48,7 +48,7 @@ export const inputBase = {
} }
const scale = [3, 5, 10, 30, 40] const scale = [3, 5, 10, 30, 40]
const fontSizes = [28, 24, 20, 16, 14, 12, 10] const fontSizes = [26, 20, 16, 14, 12, 10]
const border = { const border = {
borderColor: colors.black, borderColor: colors.black,

View file

@ -122,7 +122,7 @@ export class Toolbar extends React.Component {
toggle={() => this.toggleSettings.bind(this)} toggle={() => this.toggleSettings.bind(this)}
/> />
<InlineBlock> <InlineBlock>
<Button style={{width: 300, textAlign: 'left'}}> <Button style={{width: 180, textAlign: 'left'}}>
<img src="https://github.com/maputnik/editor/raw/master/media/maputnik.png" alt="Maputnik" style={{width: 40, height: 40, paddingRight: 5, verticalAlign: 'middle'}}/> <img src="https://github.com/maputnik/editor/raw/master/media/maputnik.png" alt="Maputnik" style={{width: 40, height: 40, paddingRight: 5, verticalAlign: 'middle'}}/>
<span style={{fontSize: 20 }}>Maputnik</span> <span style={{fontSize: 20 }}>Maputnik</span>
</Button> </Button>