-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/merge upstream #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f153a21
f27a3e9
ecd407b
e6d3126
c0fc73b
d4d7d50
ac574a9
9dffbcc
0a93f8b
0c378ad
c7c7b9b
de36b11
ff2fad0
c935838
5368bcf
d390107
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
|
|
||
| import { GeoJsonObject } from 'geojson'; | ||
| import React, { useEffect, useState } from 'react'; | ||
| import { GeoJSON } from 'react-leaflet'; | ||
| import { apiGet } from '../../apiHelpers'; | ||
| import { useDisplayPreferences } from '../../displayPreferences-context'; | ||
|
|
||
| export function WorldHeritageSitesLayer() { | ||
| const [worldHeritageSitesGeojson, setWorldHeritageSitesGeojson] = useState<GeoJsonObject>(null); | ||
| const { worldHeritageSites } = useDisplayPreferences(); | ||
|
|
||
| useEffect(() => { | ||
| apiGet('/geometries/world_heritage_sites_simplified_1m.geojson') | ||
| .then(data => setWorldHeritageSitesGeojson(data as GeoJsonObject)); | ||
| }, []); | ||
|
Comment on lines
+12
to
+15
|
||
|
|
||
| if(worldHeritageSites == "enabled") { | ||
|
||
| return worldHeritageSitesGeojson && | ||
| <GeoJSON | ||
| attribution='<a href="https://historicengland.org.uk/terms/website-terms-conditions/open-data-hub/">Historic England - Open Government Licence.</a>' | ||
| data={worldHeritageSitesGeojson} | ||
| style={{color: '#80ff80', fill: true, weight: 1, opacity: 1, fillOpacity: 0.5}} | ||
| />; | ||
| } else if (worldHeritageSites == "disabled") { | ||
|
||
| return <div></div> | ||
|
||
| } | ||
| } | ||
|
Comment on lines
+17
to
+27
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import React from 'react'; | ||
|
|
||
| import './map-button.css'; | ||
| import { useDisplayPreferences } from '../displayPreferences-context'; | ||
|
|
||
| export const WorldHeritageSitesSwitcher: React.FC<{}> = () => { | ||
| const { worldHeritageSites, worldHeritageSitesSwitch, darkLightTheme } = useDisplayPreferences(); | ||
| return ( | ||
| <form className={`map-button ${worldHeritageSites}-state ${darkLightTheme}`} onSubmit={worldHeritageSitesSwitch}> | ||
| <button className="btn btn-outline btn-outline-dark" | ||
| type="submit"> | ||
| {(worldHeritageSites === 'enabled')? 'World Heritage Sites [on]' : 'World Heritage Sites [off]'} | ||
| </button> | ||
| </form> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use strict inequality operator (!==) instead of loose inequality (!=). In TypeScript/JavaScript, it's best practice to use !== for comparisons to avoid type coercion issues.