diff --git a/frontend/src/components/map/MapLegend.tsx b/frontend/src/components/map/MapLegend.tsx index e037e44..186c9d9 100644 --- a/frontend/src/components/map/MapLegend.tsx +++ b/frontend/src/components/map/MapLegend.tsx @@ -11,6 +11,23 @@ import { gradientToCss } from '../../lib/utils'; import { CloseIcon } from '../ui/icons/CloseIcon'; import { TickerValue } from '../ui/TickerValue'; +function ResetScaleIcon({ className = 'w-4 h-4' }: { className?: string }) { + return ( + + ); +} + function EnumSwatches({ values, palette, @@ -76,6 +93,8 @@ export default function MapLegend({ suffix, raw, totalCount, + onResetScale, + resetScaleDisabled = false, }: { featureLabel: string; range: [number, number]; @@ -89,9 +108,12 @@ export default function MapLegend({ suffix?: string; raw?: boolean; totalCount?: number; + onResetScale?: () => void; + resetScaleDisabled?: boolean; }) { const { t } = useTranslation(); const isEnum = enumValues && enumValues.length > 0; + const showResetScale = Boolean(onResetScale) && !isEnum; const enumPalette = getEnumPaletteForFeature(featureName ?? null, enumValues); const densityGradient = theme === 'dark' ? DENSITY_GRADIENT_DARK : DENSITY_GRADIENT; const gradientStyle = @@ -121,11 +143,23 @@ export default function MapLegend({ {featureLabel} + {showResetScale && ( + + )} {showCancel && ( @@ -149,15 +183,33 @@ export default function MapLegend({ return (