Files
developer-roadmap/components/links-list-item.tsx

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2021-08-14 22:43:25 +02:00
import React from 'react';
import { Badge, Flex, Link, Text } from '@chakra-ui/react';
type LinksListItemProps = {
title: string;
subtitle: string;
badgeText?: string;
icon?: React.ReactChild
};
export function LinksListItem(props: LinksListItemProps) {
const { title, subtitle, badgeText, icon } = props;
return (
<Link
fontSize='15px'
py='9px'
d='flex'
2021-08-28 13:38:29 +02:00
flexDirection={['column', 'row', 'row']}
2021-08-14 22:43:25 +02:00
fontWeight={500}
color='gray.600'
2021-08-28 13:38:29 +02:00
alignItems={['flex-start', 'center']}
2021-08-14 22:43:25 +02:00
justifyContent={'space-between'}
_hover={{
textDecoration: 'none',
color: 'blue.400',
'& .list-item-title': {
transform: 'translateX(10px)'
}
}}
2021-08-28 13:38:29 +02:00
isTruncated
maxWidth='100%'
2021-08-14 22:43:25 +02:00
>
<Flex alignItems='center' className='list-item-title' transition={'200ms'}>
{icon}
2021-08-28 13:38:29 +02:00
<Text maxWidth={'345px'} isTruncated as='span'>{title}</Text>
2021-08-14 22:43:25 +02:00
{badgeText &&
<Badge pos='relative' top='1px' variant='subtle' colorScheme='purple' ml='10px'>{badgeText}</Badge>}
</Flex>
2021-08-28 13:38:29 +02:00
<Text mt={['4px', 0]} as='span' fontSize='12px' color='gray.500'>{subtitle}</Text>
2021-08-14 22:43:25 +02:00
</Link>
);
}