-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add mutations page to review mutations of municipality
- Loading branch information
Showing
6 changed files
with
2,024 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
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 @@ | ||
import { GeoJsonLayer } from "@deck.gl/layers"; | ||
import DeckGL from "@deck.gl/react"; | ||
import React, { ComponentProps } from "react"; | ||
import { useGeoData } from "src/domain/geodata"; | ||
import { MapController } from "@deck.gl/core"; | ||
|
||
export const LINE_COLOR = [100, 100, 100, 127] as const; | ||
|
||
const MutationsMap = ({ | ||
highlightedMunicipalities, | ||
geoData, | ||
...props | ||
}: { | ||
highlightedMunicipalities: { | ||
added: number[]; | ||
removed: number[]; | ||
}; | ||
geoData: ReturnType<typeof useGeoData>["data"]; | ||
} & ComponentProps<typeof DeckGL>) => { | ||
return ( | ||
<DeckGL controller={MapController} {...props}> | ||
{geoData.municipalities && ( | ||
<GeoJsonLayer | ||
id="municipalities" | ||
data={geoData.municipalities} | ||
pickable={false} | ||
stroked={true} | ||
filled={true} | ||
extruded={false} | ||
lineWidthMinPixels={0.5} | ||
lineWidthMaxPixels={1} | ||
getLineWidth={200} | ||
lineMiterLimit={1} | ||
updateTriggers={{ getFillColor: highlightedMunicipalities }} | ||
getLineColor={[30, 30, 30]} | ||
getFillColor={(d: { properties: { id: number } }) => { | ||
return highlightedMunicipalities.added.includes(d.properties.id) | ||
? [0, 255, 0, 100] | ||
: highlightedMunicipalities.removed.includes(d.properties.id) | ||
? [255, 0, 0, 100] | ||
: [255, 255, 255]; | ||
}} | ||
/> | ||
)} | ||
</DeckGL> | ||
); | ||
}; | ||
|
||
export default MutationsMap; |
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
Oops, something went wrong.