Skip to content

Commit

Permalink
Simplify animated map legend
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelekm committed Mar 1, 2023
1 parent 1ec89a5 commit aeb6ae4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
30 changes: 2 additions & 28 deletions src/app/src/components/AnimatedMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useMap } from 'react-leaflet';
import {
Heading,
Spacer,
HStack,
Box,
IconButton,
Progress,
Expand All @@ -23,6 +22,7 @@ import {
SpendingByGeographyAtMonth,
} from '../types/api';
import { spendingDataByMonth } from './dummySpendingDataByMonth';
import AnimatedMapLegend from './AnimatedMapLegend';

export default function AnimatedMap() {
return (
Expand All @@ -31,33 +31,7 @@ export default function AnimatedMap() {
Allocation of announced award funding over time
</Heading>
<Spacer></Spacer>
<Box width='100%' pl='20%'>
<HStack spacing='0px' border={'1px'} width='210px'>
<Box w='70px' h='40px' bg='white'></Box>
<Box
w='70px'
h='40px'
bg='#94A4DF'
textAlign={'center'}
color={'white'}
fontSize={'sm'}
pt='8px'
>
≥1% BIL
</Box>
<Box
w='70px'
h='40px'
bg='#465EB5'
textAlign={'center'}
color={'white'}
fontSize={'sm'}
pt='8px'
>
≥2% BIL
</Box>
</HStack>
</Box>
<AnimatedMapLegend />
<UsaMapContainer>
<StatesAndSliderLayer spending={spendingDataByMonth} />
</UsaMapContainer>
Expand Down
29 changes: 29 additions & 0 deletions src/app/src/components/AnimatedMapLegend.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { HStack, Box } from '@chakra-ui/react';

export function ColorRangeBox({ bg, text }: { bg: string, text?: String }) {
return (
<Box
w='70px'
h='40px'
bg={bg}
textAlign={'center'}
color={'white'}
fontSize={'sm'}
pt='8px'
>
{text}
</Box>
);
}

export default function AnimatedMapLegend() {
return (
<Box width='100%' pl='20%'>
<HStack spacing='0px' border={'1px'} width='210px'>
<ColorRangeBox bg='white' />
<ColorRangeBox bg='#94A4DF' text='≥1% BIL' />
<ColorRangeBox bg='#465EB5' text='≥2% BIL' />
</HStack>
</Box>
);
}

0 comments on commit aeb6ae4

Please sign in to comment.