1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-02-24 03:23:08 +01:00
developer-roadmap/components/content-page-header.tsx

61 lines
2.1 KiB
TypeScript
Raw Normal View History

2021-08-20 15:49:34 +02:00
import { Box, Container, Flex, Heading, Image, Link, Text } from '@chakra-ui/react';
import React from 'react';
2021-09-03 09:45:46 +02:00
type ContentPageHeaderProps = {
formattedDate: string;
2021-08-20 15:49:34 +02:00
title: string;
subtitle: string;
2021-09-03 09:45:46 +02:00
author?: {
name: string;
twitter: string;
picture: string;
},
subLink?: {
text: string;
url: string;
}
2021-08-20 15:49:34 +02:00
};
2021-09-03 09:45:46 +02:00
export function ContentPageHeader(props: ContentPageHeaderProps) {
const { title, subtitle, author = null, formattedDate, subLink = null } = props;
2021-08-20 15:49:34 +02:00
return (
2021-08-28 15:28:20 +02:00
<Box pt={['35px', '35px', '70px']} pb={['35px', '35px', '55px']} borderBottomWidth={1} mb='30px'>
<Container maxW='container.md' position='relative' textAlign={['left', 'left', 'center']}>
2021-09-03 09:45:46 +02:00
<Flex alignItems='center' justifyContent={['flex-start', 'flex-start', 'center']}
fontSize={['12px', '12px', '14px']}>
2021-08-29 14:05:59 +02:00
2021-09-03 09:45:46 +02:00
{author?.name && (
<>
<Link
d={['none', 'flex', 'flex']}
target='_blank'
href={`https://twitter.com/${author.twitter}`}
alignItems='center'
fontWeight={600}
color='gray.500'
>
2021-09-05 18:27:34 +02:00
<Image alt={''} rounded={'full'} mr='7px' w='22px' src={author.picture} />
2021-09-03 09:45:46 +02:00
{author.name}
</Link>
<Text d={['none', 'inline', 'inline']} mx='7px' color='gray.500' as='span'>&middot;</Text>
</>
)}
2021-08-29 14:05:59 +02:00
2021-09-03 09:45:46 +02:00
<Text color='gray.500' as='span'>{formattedDate}</Text>
{subLink?.text && (
<>
<Text d={['none', 'none', 'inline']} mx='7px' color='gray.500' as='span'>&middot;</Text>
<Link d={['none', 'none', 'inline']} color='blue.500' fontWeight={500}
href={subLink.url} target={'_blank'}>{subLink.text}</Link>
</>
)}
2021-08-20 15:49:34 +02:00
</Flex>
2021-08-28 15:28:20 +02:00
<Heading as='h1' color='black' fontSize={['30px', '30px', '45px']} lineHeight={['40px', '40px', '53px']}
fontWeight={700} my={['5px', '5px', '10px']}>{title}</Heading>
<Text fontSize={['14px', '14px', '16px']} color='gray.700'>{subtitle}</Text>
2021-08-20 15:49:34 +02:00
</Container>
</Box>
);
}