Add click a building... notice to map

This commit is contained in:
Tom Russell 2019-01-19 19:06:26 +00:00
parent 9d1094cdd5
commit 8e7eea1369
4 changed files with 28 additions and 3 deletions

View File

@ -10,7 +10,9 @@
float: right; float: right;
background: white; background: white;
border-radius: 4px; border-radius: 4px;
padding: 0.25rem 0; padding: 0.5rem 0 0.25rem;
border: 1px solid #fff;
box-shadow: 0px 0px 1px 1px #222222;
} }
@media (min-width: 380px){ @media (min-width: 380px){
.map-legend { .map-legend {

View File

@ -1,4 +1,14 @@
.map-notice {
padding: 0.5rem 0.75rem;
background: #fff;
border: 1px solid #fff;
border-radius: 4px;
z-index: 1000;
position: absolute;
left: 25.5rem;
top: 0.5rem;
box-shadow: 0px 0px 1px 1px #222;
}
.leaflet-container { .leaflet-container {
position: absolute; position: absolute;
top: 0; top: 0;
@ -6,3 +16,7 @@
left: 0; left: 0;
right: 0; right: 0;
} }
.leaflet-container .leaflet-control-zoom {
border: 1px solid #fff;
box-shadow: 0 0 1px 1px #222;
}

View File

@ -6,6 +6,7 @@ import './map.css'
import ThemeSwitcher from './theme-switcher'; import ThemeSwitcher from './theme-switcher';
import { parseCategoryURL } from '../parse'; import { parseCategoryURL } from '../parse';
import Legend from './legend'; import Legend from './legend';
import { HelpIcon } from './icons';
const OS_API_KEY = 'NVUxtY5r8eA6eIfwrPTAGKrAAsoeI9E9'; const OS_API_KEY = 'NVUxtY5r8eA6eIfwrPTAGKrAAsoeI9E9';
@ -70,6 +71,7 @@ class ColouringMap extends Component {
// colour-data tiles // colour-data tiles
const is_building = /building/.test(this.props.match.url); const is_building = /building/.test(this.props.match.url);
const is_edit = /edit/.test(this.props.match.url);
const cat = parseCategoryURL(this.props.match.url); const cat = parseCategoryURL(this.props.match.url);
const tileset_by_cat = { const tileset_by_cat = {
age: 'date_year', age: 'date_year',
@ -121,6 +123,13 @@ class ColouringMap extends Component {
<ZoomControl position="topright" /> <ZoomControl position="topright" />
<AttributionControl prefix="" /> <AttributionControl prefix="" />
</Map> </Map>
{
!is_building? (
<div class="map-notice">
<HelpIcon /> {is_edit? 'Click a building to edit' : 'Click a building for details'}
</div>
) : null
}
<Legend slug={cat} /> <Legend slug={cat} />
<ThemeSwitcher onSubmit={this.themeSwitch} currentTheme={this.state.theme} /> <ThemeSwitcher onSubmit={this.themeSwitch} currentTheme={this.state.theme} />
</Fragment> </Fragment>

View File

@ -1,7 +1,7 @@
.theme-switcher { .theme-switcher {
z-index: 1000; z-index: 1000;
position: absolute; position: absolute;
top: 75px; top: 77px;
right: 10px; right: 10px;
float: right; float: right;
background: white; background: white;