mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-15 03:33:26 +01:00
Add hover effect for collapse header
This commit is contained in:
parent
92996b1db5
commit
53f0a6adda
3 changed files with 15 additions and 14 deletions
|
@ -142,9 +142,7 @@ export default class LayerEditor extends React.Component {
|
||||||
</LayerEditorGroup>
|
</LayerEditorGroup>
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div style={{
|
return <div>
|
||||||
padding: margins[0],
|
|
||||||
}}>
|
|
||||||
{propertyGroups}
|
{propertyGroups}
|
||||||
{dataGroup}
|
{dataGroup}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import Color from 'color'
|
||||||
import colors from '../../config/colors'
|
import colors from '../../config/colors'
|
||||||
import { margins, fontSizes } from '../../config/scales'
|
import { margins, fontSizes } from '../../config/scales'
|
||||||
|
|
||||||
|
@ -28,32 +29,35 @@ export default class LayerEditorGroup extends React.Component {
|
||||||
onActiveToggle: React.PropTypes.func.isRequired
|
onActiveToggle: React.PropTypes.func.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.state = { hover: false }
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div>
|
return <div>
|
||||||
<div style={{
|
<div style={{
|
||||||
fontSize: fontSizes[4],
|
fontSize: fontSizes[4],
|
||||||
backgroundColor: colors.gray,
|
backgroundColor: this.state.hover ? Color(colors.black).lighten(0.30).string() : Color(colors.black).lighten(0.15).string(),
|
||||||
color: colors.lowgray,
|
color: colors.lowgray,
|
||||||
|
cursor: 'pointer',
|
||||||
|
userSelect: 'none',
|
||||||
padding: margins[1],
|
padding: margins[1],
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
lineHeight: '20px',
|
lineHeight: '20px',
|
||||||
}}
|
}}
|
||||||
|
onMouseOver={e => this.setState({hover: true})}
|
||||||
|
onMouseOut={e => this.setState({hover: false})}
|
||||||
onClick={e => this.props.onActiveToggle(!this.props.isActive)}
|
onClick={e => this.props.onActiveToggle(!this.props.isActive)}
|
||||||
>
|
>
|
||||||
<span>{this.props.title}</span>
|
<span>{this.props.title}</span>
|
||||||
<span style={{flexGrow: 1}} />
|
<span style={{flexGrow: 1}} />
|
||||||
<Collapser isCollapsed={this.props.isActive} />
|
<Collapser isCollapsed={this.props.isActive} />
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<Collapse isOpened={this.props.isActive}>
|
||||||
border: 2,
|
{this.props.children}
|
||||||
borderStyle: 'solid',
|
</Collapse>
|
||||||
borderColor: colors.gray,
|
|
||||||
}}>
|
|
||||||
<Collapse isOpened={this.props.isActive}>
|
|
||||||
{this.props.children}
|
|
||||||
</Collapse>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,6 @@ class LayerListItem extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.state.hover) {
|
if(this.state.hover) {
|
||||||
console.log('hooover')
|
|
||||||
itemStyle.backgroundColor = Color(colors.black).lighten(0.10).string()
|
itemStyle.backgroundColor = Color(colors.black).lighten(0.10).string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue