mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-30 16:15:30 +01:00
Add toolbar hover with pixel hacks
This commit is contained in:
parent
a30779193f
commit
a5a7dab8e7
1 changed files with 27 additions and 10 deletions
|
@ -29,10 +29,10 @@ const IconText = props => <span style={{ paddingLeft: margins[0] }}>
|
||||||
|
|
||||||
const actionStyle = {
|
const actionStyle = {
|
||||||
display: "inline-block",
|
display: "inline-block",
|
||||||
padding: margins[1],
|
padding: 12.5,
|
||||||
fontSize: fontSizes[4],
|
fontSize: fontSizes[4],
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
color: colors.white,
|
color: colors.white,
|
||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,14 +46,30 @@ const ToolbarLink = props => <a
|
||||||
{props.children}
|
{props.children}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
const ToolbarAction = props => <a onClick={props.onClick}
|
class ToolbarAction extends React.Component {
|
||||||
style={{
|
static propTypes = {
|
||||||
...actionStyle,
|
onClick: React.PropTypes.func.isRequired,
|
||||||
...props.style,
|
}
|
||||||
}}>
|
|
||||||
{props.children}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.state = { hover: false }
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return <a
|
||||||
|
onClick={this.props.onClick}
|
||||||
|
onMouseOver={e => this.setState({hover: true})}
|
||||||
|
onMouseOut={e => this.setState({hover: false})}
|
||||||
|
style={{
|
||||||
|
...actionStyle,
|
||||||
|
...this.props.style,
|
||||||
|
backgroundColor: this.state.hover ? colors.gray : null,
|
||||||
|
}}>
|
||||||
|
{this.props.children}
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default class Toolbar extends React.Component {
|
export default class Toolbar extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -124,7 +140,8 @@ export default class Toolbar extends React.Component {
|
||||||
<ToolbarAction style={{
|
<ToolbarAction style={{
|
||||||
width: 180,
|
width: 180,
|
||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
backgroundColor: colors.black
|
backgroundColor: colors.black,
|
||||||
|
padding: 5,
|
||||||
}}>
|
}}>
|
||||||
<img src="https://github.com/maputnik/editor/raw/master/media/maputnik.png" alt="Maputnik" style={{width: 30, height: 30, paddingRight: 5, verticalAlign: 'middle'}}/>
|
<img src="https://github.com/maputnik/editor/raw/master/media/maputnik.png" alt="Maputnik" style={{width: 30, height: 30, paddingRight: 5, verticalAlign: 'middle'}}/>
|
||||||
<span style={{fontSize: 20, verticalAlign: 'middle' }}>Maputnik</span>
|
<span style={{fontSize: 20, verticalAlign: 'middle' }}>Maputnik</span>
|
||||||
|
|
Loading…
Reference in a new issue