diff --git a/src/App.svelte b/src/App.svelte
index 50f68c2..f94e26f 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -4,6 +4,9 @@
import * as pmtiles from "pmtiles";
import layers from "protomaps-themes-base";
+ import Legend from "./Legend.svelte";
+ import text from "./text.json";
+
const protocol = new pmtiles.Protocol();
maplibregl.addProtocol("pmtiles", protocol.tile);
@@ -74,25 +77,28 @@
firstSymbolLayer.id
);
- map.addLayer({
- id: "fires-lines",
- source: "fires",
- "source-layer": "all-years",
- type: "line",
- paint: {
- "line-color": "#fff",
- "line-opacity": 0.5,
- "line-width": [
- "interpolate",
- ["linear", 0.5],
- ["zoom"],
- 6,
- 0,
- 16,
- 0.75,
- ],
+ map.addLayer(
+ {
+ id: "fires-lines",
+ source: "fires",
+ "source-layer": "all-years",
+ type: "line",
+ paint: {
+ "line-color": "#fff",
+ "line-opacity": 0.5,
+ "line-width": [
+ "interpolate",
+ ["linear", 0.5],
+ ["zoom"],
+ 6,
+ 0,
+ 16,
+ 0.75,
+ ],
+ },
},
- });
+ firstSymbolLayer.id
+ );
}
@@ -100,6 +106,24 @@
+{#if map}
+
+{/if}
+
diff --git a/src/Legend.svelte b/src/Legend.svelte
new file mode 100644
index 0000000..560e182
--- /dev/null
+++ b/src/Legend.svelte
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
diff --git a/src/app.css b/src/app.css
index a92633e..0bd0b98 100644
--- a/src/app.css
+++ b/src/app.css
@@ -4,8 +4,8 @@
font-weight: 400;
color-scheme: light dark;
- color: rgba(255, 255, 255, 0.87);
- background-color: #242424;
+ color: #213547;
+ background-color: #ffffff;
font-synthesis: none;
text-rendering: optimizeLegibility;
@@ -19,7 +19,7 @@ a {
text-decoration: inherit;
}
a:hover {
- color: #535bf2;
+ color: #747bff;
}
body {
@@ -51,27 +51,16 @@ button {
font-size: 1em;
font-weight: 500;
font-family: inherit;
- background-color: #1a1a1a;
+ background-color: #f9f9f9;
cursor: pointer;
transition: border-color 0.25s;
}
+
button:hover {
border-color: #646cff;
}
+
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
-
-@media (prefers-color-scheme: light) {
- :root {
- color: #213547;
- background-color: #ffffff;
- }
- a:hover {
- color: #747bff;
- }
- button {
- background-color: #f9f9f9;
- }
-}
diff --git a/src/text.json b/src/text.json
new file mode 100644
index 0000000..b1510b3
--- /dev/null
+++ b/src/text.json
@@ -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"]
+ ]
+ }
+}