-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
137 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script> | ||
import { onMount, onDestroy } from "svelte"; | ||
export let map; | ||
export let position = "top-right"; | ||
export let dark = false; | ||
let container; | ||
const control = { | ||
onAdd() { | ||
return container; | ||
}, | ||
onRemove() {}, | ||
}; | ||
onMount(() => { | ||
map.addControl(control, position); | ||
}); | ||
onDestroy(() => { | ||
map.removeControl(control); | ||
}); | ||
</script> | ||
|
||
<div bind:this={container} class="legend" class:dark> | ||
<slot /> | ||
</div> | ||
|
||
<style> | ||
.legend { | ||
background-color: white; | ||
border-radius: 5px; | ||
margin: 2em; | ||
max-width: 200px; | ||
padding: 1em; | ||
pointer-events: all; | ||
position: relative; | ||
z-index: 10; | ||
} | ||
.legend.dark { | ||
background-color: black; | ||
} | ||
.legend.dark :global(*) { | ||
color: #fff; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"headline": "Wildfires are becoming more frequent across the West", | ||
"source": "National Interagency Fire Center", | ||
"legend": { | ||
"title": "Burned areas", | ||
"description": "This map shows the perimeters of all wildfires in the United States between 1980 and 2021. Zoom in and click any individual fire for details. Click a decade in the legend to filter by decade.", | ||
"items": [ | ||
["#ffffb2", "1980 to 1990"], | ||
["#fecc5c", "1990 to 2000"], | ||
["#fd8d3c", "2000 to 2010"], | ||
["#e31a1c", "2010 to 2020"] | ||
] | ||
} | ||
} |