Files
developer-roadmap/components/guide/guide-grid-item.tsx

32 lines
924 B
TypeScript
Raw Permalink Normal View History

2021-08-15 15:57:21 +02:00
import { Badge, Box, Heading, Link, Text } from '@chakra-ui/react';
type GuideGridItemProps = {
title: string;
2021-09-03 10:52:43 +02:00
href: string;
2021-08-15 15:57:21 +02:00
subtitle: string;
date: string;
isNew?: boolean;
colorIndex?: number;
};
const bgColorList = [
'gray.700',
'purple.800'
];
export function GuideGridItem(props: GuideGridItemProps) {
2021-09-03 10:52:43 +02:00
const { title, subtitle, date, isNew = false, colorIndex = 0, href } = props;
2021-08-15 15:57:21 +02:00
return (
2021-09-03 10:52:43 +02:00
<Box _hover={{ textDecoration: 'none', transform: 'scale(1.02)' }} as={Link} href={href} shadow='xl' p='20px'
rounded='10px' bg={bgColorList[colorIndex] ?? bgColorList[0]} flex={1}>
2021-08-15 15:57:21 +02:00
<Text mb='10px' fontSize='13px' color='gray.400'>
{isNew && <Badge colorScheme={'yellow'} mr='10px'>New</Badge>}
{date}
</Text>
<Heading color='white' mb={'6px'} fontSize='20px'>{title}</Heading>
<Text color='gray.300' fontSize='14px'>{subtitle}</Text>
2021-09-03 10:52:43 +02:00
</Box>
2021-08-15 15:57:21 +02:00
);
}