mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-27 11:15:22 +01:00
Switch from react-aria-menubutton to <select/>
This commit is contained in:
parent
e4aa016713
commit
a356bfd601
4 changed files with 41 additions and 31 deletions
|
@ -1,7 +1,6 @@
|
|||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import classnames from 'classnames'
|
||||
import { Wrapper, Button, Menu, MenuItem } from 'react-aria-menubutton'
|
||||
|
||||
import MdFileDownload from 'react-icons/lib/md/file-download'
|
||||
import OpenIcon from 'react-icons/lib/md/open-in-browser'
|
||||
|
@ -72,6 +71,22 @@ class ToolbarLinkHighlighted extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
class ToolbarSelect extends React.Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.node,
|
||||
wdKey: PropTypes.string
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div
|
||||
className='maputnik-toolbar-select'
|
||||
data-wd-key={this.props.wdKey}
|
||||
>
|
||||
{this.props.children}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
class ToolbarAction extends React.Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.node,
|
||||
|
@ -195,34 +210,19 @@ export default class Toolbar extends React.Component {
|
|||
<IconText>Style Settings</IconText>
|
||||
</ToolbarAction>
|
||||
|
||||
<Wrapper
|
||||
className='map-state-menu'
|
||||
onSelection={(val) => this.handleSelection(val)}
|
||||
>
|
||||
<Button wdKey="nav:settings" className="maputnik-toolbar-action">
|
||||
<ToolbarSelect wdKey="nav:inspect">
|
||||
<ViewIcon/>
|
||||
<IconText>View: {currentView.title}</IconText>
|
||||
</Button>
|
||||
<Menu>
|
||||
<ul className="map-state-menu__menu">
|
||||
<IconText>View </IconText>
|
||||
<select onChange={(e) => this.handleSelection(e.target.value)}>
|
||||
{views.map((item) => {
|
||||
return (
|
||||
<li key={item.id}>
|
||||
<MenuItem value={item.id}>
|
||||
<button
|
||||
className="maputnik-toolbar-action"
|
||||
>
|
||||
{item.icon}
|
||||
<IconText>{item.title}</IconText>
|
||||
</button>
|
||||
</MenuItem>
|
||||
</li>
|
||||
<option value={item.id}>
|
||||
{item.title}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Menu>
|
||||
</Wrapper>
|
||||
|
||||
</select>
|
||||
</ToolbarSelect>
|
||||
|
||||
<ToolbarLink href={"https://github.com/maputnik/editor/wiki"}>
|
||||
<HelpIcon />
|
||||
|
|
|
@ -92,6 +92,16 @@
|
|||
@extend .maputnik-toolbar-link;
|
||||
}
|
||||
|
||||
.maputnik-toolbar-select {
|
||||
background: inherit;
|
||||
border-width: 0;
|
||||
@extend .maputnik-toolbar-link;
|
||||
}
|
||||
|
||||
.maputnik-toolbar-select select {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.maputnik-icon-text {
|
||||
padding-left: $margin-1;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ describe("modals", function() {
|
|||
"geojson:example"
|
||||
]));
|
||||
|
||||
browser.click(wd.$("nav:inspect"));
|
||||
browser.setValue(wd.$("nav:inspect", "select"), "inspect");
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ describe('screenshots', function() {
|
|||
browser.waitForExist(".maputnik-toolbar-link");
|
||||
browser.flushReactUpdates();
|
||||
|
||||
browser.click(wd.$("nav:inspect"))
|
||||
browser.setValue(wd.$("nav:inspect", "select"), "inspect");
|
||||
browser.flushReactUpdates();
|
||||
|
||||
browser.takeScreenShot("/inspect.png")
|
||||
|
|
Loading…
Reference in a new issue