1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-02-24 11:33:09 +01:00

77 lines
2.3 KiB
TypeScript
Raw Normal View History

2021-09-03 12:59:44 +02:00
import { Box, Container, SimpleGrid } from '@chakra-ui/react';
2021-08-20 17:06:26 +02:00
import { GlobalHeader } from '../../components/global-header';
2021-08-15 10:39:46 +02:00
import { LinksList } from '../../components/links-list';
import { LinksListItem } from '../../components/links-list-item';
import { OpensourceBanner } from '../../components/opensource-banner';
import { Footer } from '../../components/footer';
2021-09-05 17:26:54 +02:00
import { GuideGridItem } from '../../components/guide/guide-grid-item';
2021-08-15 16:07:05 +02:00
import { PageHeader } from '../../components/page-header';
2021-09-03 12:59:44 +02:00
import { getAllGuides, GuideType } from '../../lib/guide';
2021-09-04 22:58:58 +02:00
import Helmet from '../../components/helmet';
2021-09-03 10:11:33 +02:00
type GuidesProps = {
guides: GuideType[]
}
export default function Guides(props: GuidesProps) {
const { guides = [] } = props;
const recentGuides = guides.slice(0, 2);
const oldGuides = guides.slice(2);
2021-08-15 10:39:46 +02:00
2021-08-14 20:29:05 +02:00
return (
2021-08-15 10:39:46 +02:00
<Box bg='white' minH='100vh'>
2021-08-20 17:06:26 +02:00
<GlobalHeader />
2021-09-04 22:58:58 +02:00
<Helmet
title={'Visual Guides'}
description={'Succinct graphical explanations to engineering topics.'}
/>
2021-08-15 10:39:46 +02:00
<Box mb='60px'>
2021-08-15 16:07:05 +02:00
<PageHeader
title={'Visual Guides'}
2021-09-03 10:52:43 +02:00
subtitle={'Succinct graphical explanations to engineering topics.'}
2021-08-15 16:07:05 +02:00
/>
<Container maxW='container.md' position='relative'>
2021-08-28 15:28:20 +02:00
<SimpleGrid columns={[1, 1, 2]} mb='30px' spacing={['10px', '10px', '15px']}>
2021-09-03 10:11:33 +02:00
{recentGuides.map((recentGuide, counter) => (
<GuideGridItem
key={recentGuide.id}
2021-09-03 16:27:30 +02:00
href={`/guides/${recentGuide.id}`}
2021-09-03 10:11:33 +02:00
title={recentGuide.title}
subtitle={recentGuide.description}
2021-09-03 12:59:44 +02:00
date={recentGuide.formattedUpdatedAt!}
2021-09-03 10:11:33 +02:00
isNew
colorIndex={counter}
/>
))}
2021-08-28 15:28:20 +02:00
</SimpleGrid>
2021-08-15 10:39:46 +02:00
<LinksList>
2021-09-03 10:11:33 +02:00
{oldGuides.map(oldGuide => (
<LinksListItem
2021-09-03 16:27:30 +02:00
href={`/guides/${oldGuide.id}`}
2021-09-03 10:11:33 +02:00
key={oldGuide.id}
title={oldGuide.title}
badgeText={oldGuide.isPro ? 'PRO' : ''}
2021-09-03 12:59:44 +02:00
subtitle={oldGuide.formattedUpdatedAt!}
2021-09-03 10:11:33 +02:00
/>
))}
2021-08-15 10:39:46 +02:00
</LinksList>
</Container>
</Box>
<OpensourceBanner />
<Footer />
</Box>
2021-08-14 20:29:05 +02:00
);
}
2021-09-03 10:11:33 +02:00
export async function getStaticProps() {
return {
props: {
guides: getAllGuides()
}
};
}