1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-02-23 11:05:52 +01:00
developer-roadmap/components/roadmap/home-roadmap-item.tsx

122 lines
2.5 KiB
TypeScript
Raw Normal View History

2022-08-29 18:48:57 +04:00
import { Badge, 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;
2022-08-29 18:48:57 +04:00
isNew?: boolean;
2021-08-29 21:31:29 +02:00
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',
2022-08-29 18:48:57 +04:00
'red.200'
2021-08-16 00:10:18 +02:00
];
export function HomeRoadmapItem(props: RoadmapGridItemProps) {
const {
title,
subtitle,
isCommunity,
2022-08-29 18:48:57 +04:00
isNew,
colorIndex = 0,
url,
2022-08-29 18:48:57 +04:00
isUpcoming
} = props;
2021-08-16 00:10:18 +02:00
return (
2021-08-29 21:31:29 +02:00
<Box
2022-09-26 20:42:32 +04:00
position='relative'
2021-08-29 21:31:29 +02:00
as={Link}
href={url}
2021-11-27 12:46:24 +01:00
_hover={{
textDecoration: 'none',
2022-08-29 18:48:57 +04: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': {
2022-08-29 18:48:57 +04: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}
2022-08-29 18:48:57 +04:00
shadow='2xl'
2021-11-22 16:49:32 +01:00
className={'home-roadmap-item'}
bg={'rgba(255,255,255,.05)'}
2022-08-29 18:48:57 +04:00
color='white'
p='15px'
rounded='10px'
pos='relative'
2021-08-16 00:10:18 +02:00
>
{isCommunity && (
2022-08-29 18:48:57 +04:00
<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]}
2022-08-29 18:48:57 +04:00
mb='5px'
d='flex'
alignItems='center'
>
{title}
2022-08-29 18:48:57 +04:00
2022-09-26 20:42:32 +04:00
{ isNew && <Badge position='absolute' bottom={0} right={0} colorScheme='yellow' ml='10px'>New</Badge> }
</Heading>
2022-08-29 18:48:57 +04:00
<Text color='gray.200' fontSize={['13px']}>
{subtitle}
</Text>
2021-09-22 14:50:03 +02:00
{isUpcoming && (
<Flex
2022-08-29 18:48:57 +04:00
alignItems='center'
justifyContent='center'
pos='absolute'
2021-09-22 14:50:03 +02:00
left={0}
right={0}
top={0}
bottom={0}
2022-08-29 18:48:57 +04:00
rounded='10px'
2021-09-22 14:50:03 +02:00
>
<Text
2022-08-29 18:48:57 +04:00
color='white'
bg='gray.600'
zIndex={1}
fontWeight={600}
p={'5px 10px'}
2022-08-29 18:48:57 +04:00
rounded='10px'
>
Upcoming
</Text>
<Box
bg={'black'}
2022-08-29 18:48:57 +04:00
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
);
}