From ab6666bf0ebe55d47433d1979ca104fc925f29e0 Mon Sep 17 00:00:00 2001 From: Andreas Hubel Date: Sat, 23 Sep 2023 18:11:57 +0200 Subject: [PATCH] chore: color markers based on state --- frontend/src/components/Marker.jsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Marker.jsx b/frontend/src/components/Marker.jsx index 3633038..6a51097 100644 --- a/frontend/src/components/Marker.jsx +++ b/frontend/src/components/Marker.jsx @@ -4,8 +4,21 @@ import { CircleMarker, Popup } from 'react-leaflet'; import theme from '../style/theme'; import { spacedataElementStruct } from '../redux/modules/spacedata'; + +const markerColor = (spacedata) => { + switch (spacedata.state?.open) { + case true: + return theme.palette.secondary.light; + case false: + return theme.palette.error.light; + default: + return theme.palette.primary.main; + } +}; const Marker = (props) => { - const color = props.highlight ? theme.palette.secondary.light : theme.palette.primary.main; + // change color based on space status + const color = markerColor(props.spacedata); + // const color = props.highlight ? theme.palette.secondary.light : const style = { container: {