diff --git a/packages/app/src/components/choropleth-legenda.tsx b/packages/app/src/components/choropleth-legenda.tsx index faeaa0b1c0..a1c052552a 100644 --- a/packages/app/src/components/choropleth-legenda.tsx +++ b/packages/app/src/components/choropleth-legenda.tsx @@ -1,30 +1,24 @@ import { ChoroplethThresholdsValue, colors } from '@corona-dashboard/common'; -import { css, SystemStyleObject } from '@styled-system/css'; -import styled from 'styled-components'; import { ValueAnnotation } from '~/components/value-annotation'; import { useIntl } from '~/intl'; -import { space, fontSizes } from '~/style/theme'; import { replaceVariablesInText } from '~/utils'; import { useBreakpoints } from '~/utils/use-breakpoints'; -import { useResizeObserver } from '~/utils/use-resize-observer'; import { Box } from './base'; import { Legend, LegendItem } from './legend'; -import { InlineText, Text } from './typography'; +import { Text } from './typography'; interface ChoroplethLegendaProps { title: string; thresholds: ChoroplethThresholdsValue[]; valueAnnotation?: string; - type?: 'default' | 'bar'; pageType?: string; outdatedDataLabel?: string; } -export function ChoroplethLegenda({ title, thresholds, valueAnnotation, type = 'bar', pageType, outdatedDataLabel }: ChoroplethLegendaProps) { - const [itemRef, itemSize] = useResizeObserver(); - const [endLabelRef, endLabelSize] = useResizeObserver(); - const { commonTexts, formatNumber } = useIntl(); +export function ChoroplethLegenda({ title, thresholds, valueAnnotation, pageType, outdatedDataLabel }: ChoroplethLegendaProps) { + const { commonTexts } = useIntl(); const breakpoints = useBreakpoints(true); + const legendItems = thresholds.map( (x: ChoroplethThresholdsValue, i) => ({ @@ -41,105 +35,21 @@ export function ChoroplethLegenda({ title, thresholds, valueAnnotation, type = ' } as LegendItem) ); + if (pageType === 'sewer') { + legendItems.push({ + label: outdatedDataLabel, + shape: 'square', + color: colors.yellow1, + } as LegendItem); + } + return ( -