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

73 lines
2.2 KiB
TypeScript
Raw Normal View History

2021-08-28 15:28:20 +02:00
import { Box, Container, SimpleGrid, Stack } 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 { UpdatesBanner } from '../../components/updates-banner';
import { Footer } from '../../components/footer';
2021-08-15 15:57:21 +02:00
import { GuideGridItem } from './components/guide-grid-item';
2021-08-15 16:07:05 +02:00
import { PageHeader } from '../../components/page-header';
2021-09-03 10:11:33 +02:00
import { getAllGuides, getGuideById, GuideType } from '../../lib/guide';
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-08-15 10:39:46 +02:00
<Box mb='60px'>
2021-08-15 16:07:05 +02:00
<PageHeader
title={'Visual Guides'}
subtitle={'Succinct graphical explanations to development related topics.'}
/>
<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}
title={recentGuide.title}
subtitle={recentGuide.description}
date={recentGuide.formattedUpdatedAt}
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
href={oldGuide.url}
key={oldGuide.id}
title={oldGuide.title}
badgeText={oldGuide.isPro ? 'PRO' : ''}
subtitle={oldGuide.formattedUpdatedAt}
/>
))}
2021-08-15 10:39:46 +02:00
</LinksList>
</Container>
</Box>
<OpensourceBanner />
<UpdatesBanner />
<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()
}
};
}