Files
developer-roadmap/components/roadmap/home-roadmap-item.tsx

115 lines
2.3 KiB
TypeScript
Raw Permalink Normal View History

2021-09-22 14:50:03 +02:00
import { Box, Flex, Heading, Link, Text, Tooltip } from '@chakra-ui/react';
2021-08-16 00:10:18 +02:00
import { InfoIcon } from '@chakra-ui/icons';
type RoadmapGridItemProps = {
title: string;
subtitle: string;
isCommunity?: boolean;
2021-09-22 14:50:03 +02:00
isUpcoming?: boolean;
2021-08-29 21:31:29 +02:00
colorIndex?: number;
url: string;
2021-08-16 00:10:18 +02:00
};
const bgColorList = [
2021-11-22 17:30:10 +01:00
'red.100',
'yellow.100',
'green.200',
'teal.200',
'blue.200',
'red.200',
'gray.200',
'teal.200',
'yellow.100',
'green.200',
'red.200',
2021-08-16 00:10:18 +02:00
];
export function HomeRoadmapItem(props: RoadmapGridItemProps) {
const {
title,
subtitle,
isCommunity,
colorIndex = 0,
url,
isUpcoming,
} = props;
2021-08-16 00:10:18 +02:00
return (
2021-08-29 21:31:29 +02:00
<Box
as={Link}
href={url}
2021-11-27 12:46:24 +01:00
_hover={{
textDecoration: 'none',
2021-12-08 19:10:44 +01:00
bg: 'rgba(255,255,255,.10)',
2021-11-27 12:46:24 +01:00
}}
sx={{
// On mobile devices, don't change the scale
'@media (hover: none)': {
'&:hover': {
2021-12-08 19:10:44 +01:00
bg: 'rgba(255,255,255,.05)',
},
},
2021-11-27 12:46:24 +01:00
}}
2021-08-16 00:10:18 +02:00
flex={1}
shadow="2xl"
2021-11-22 16:49:32 +01:00
className={'home-roadmap-item'}
bg={'rgba(255,255,255,.05)'}
color="white"
p="15px"
rounded="10px"
pos="relative"
2021-08-16 00:10:18 +02:00
>
{isCommunity && (
<Tooltip label={'Community contribution'} hasArrow placement="top">
<InfoIcon opacity={0.5} position="absolute" top="10px" right="10px" />
2021-08-16 00:10:18 +02:00
</Tooltip>
)}
<Heading
fontSize={['17px', '17px', '22px']}
color={bgColorList[colorIndex]}
mb="5px"
>
{title}
</Heading>
<Text color="gray.200" fontSize={['13px']}>
{subtitle}
</Text>
2021-09-22 14:50:03 +02:00
{isUpcoming && (
<Flex
alignItems="center"
justifyContent="center"
pos="absolute"
2021-09-22 14:50:03 +02:00
left={0}
right={0}
top={0}
bottom={0}
rounded="10px"
2021-09-22 14:50:03 +02:00
>
<Text
color="white"
bg="gray.600"
zIndex={1}
fontWeight={600}
p={'5px 10px'}
rounded="10px"
>
Upcoming
</Text>
<Box
bg={'black'}
pos="absolute"
top={0}
left={0}
right={0}
bottom={0}
rounded={'10px'}
opacity={0.5}
/>
2021-09-22 14:50:03 +02:00
</Flex>
)}
2021-08-29 21:31:29 +02:00
</Box>
2021-08-16 00:10:18 +02:00
);
}