computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
3.4 KiB
122 lines
3.4 KiB
3 years ago
|
import { Box, Button, Container, Link, Stack } from '@chakra-ui/react';
|
||
3 years ago
|
import { ArrowBackIcon, AtSignIcon, DownloadIcon } from '@chakra-ui/icons';
|
||
|
import { GlobalHeader } from '../../components/global-header';
|
||
|
import { OpensourceBanner } from '../../components/opensource-banner';
|
||
|
import { UpdatesBanner } from '../../components/updates-banner';
|
||
|
import { Footer } from '../../components/footer';
|
||
|
import { PageHeader } from '../../components/page-header';
|
||
|
import { getAllRoadmaps, getRoadmapById, RoadmapType } from '../../lib/roadmap';
|
||
|
import MdRenderer from '../../components/md-renderer';
|
||
|
import Helmet from '../../components/helmet';
|
||
3 years ago
|
|
||
3 years ago
|
type RoadmapProps = {
|
||
|
roadmap: RoadmapType;
|
||
|
};
|
||
3 years ago
|
|
||
3 years ago
|
function TextualRoadmap(props: RoadmapProps) {
|
||
|
const { roadmap } = props;
|
||
3 years ago
|
if (!roadmap.resourcesPath) {
|
||
3 years ago
|
return null;
|
||
3 years ago
|
}
|
||
3 years ago
|
|
||
3 years ago
|
// Remove trailing slashes
|
||
3 years ago
|
const normalizedPath = roadmap.resourcesPath.replace(/^\//, '');
|
||
|
const RoadmapContent = require(`../../content/${normalizedPath}`).default;
|
||
3 years ago
|
|
||
|
return (
|
||
|
<Container maxW={'container.md'} position='relative'>
|
||
|
<MdRenderer>
|
||
|
<RoadmapContent />
|
||
|
</MdRenderer>
|
||
|
</Container>
|
||
|
);
|
||
|
}
|
||
3 years ago
|
|
||
3 years ago
|
export default function Roadmap(props: RoadmapProps) {
|
||
|
const { roadmap } = props;
|
||
3 years ago
|
|
||
3 years ago
|
return (
|
||
|
<Box bg='white' minH='100vh'>
|
||
3 years ago
|
<GlobalHeader />
|
||
3 years ago
|
<Helmet
|
||
|
title={roadmap?.seo?.title || roadmap.title}
|
||
|
description={roadmap?.seo?.description || roadmap.description}
|
||
|
keywords={roadmap?.seo.keywords || []}
|
||
|
/>
|
||
3 years ago
|
<Box mb='60px'>
|
||
|
<PageHeader
|
||
3 years ago
|
title={roadmap.title}
|
||
|
subtitle={roadmap.description}
|
||
3 years ago
|
>
|
||
|
<Stack mt='20px' isInline>
|
||
3 years ago
|
<Button d={['none', 'flex']} as={Link} href={'/roadmaps'} size='xs' py='14px' px='10px'
|
||
|
leftIcon={<ArrowBackIcon />}
|
||
|
colorScheme='teal' variant='solid' _hover={{ textDecoration: 'none' }}>
|
||
|
All Roadmaps
|
||
|
</Button>
|
||
|
|
||
3 years ago
|
{roadmap.pdfUrl && (
|
||
|
<Button as={Link}
|
||
|
href={roadmap.pdfUrl}
|
||
|
target='_blank'
|
||
|
size='xs'
|
||
|
py='14px'
|
||
|
px='10px'
|
||
|
leftIcon={<DownloadIcon />}
|
||
|
colorScheme='yellow'
|
||
|
variant='solid'
|
||
|
_hover={{ textDecoration: 'none' }}>
|
||
|
Download PDF
|
||
|
</Button>
|
||
|
)}
|
||
3 years ago
|
<Button as={Link} href={'/signup'} size='xs' py='14px' px='10px' leftIcon={<AtSignIcon />}
|
||
3 years ago
|
colorScheme='yellow' variant='solid' _hover={{ textDecoration: 'none' }}>
|
||
3 years ago
|
Subscribe
|
||
|
</Button>
|
||
|
</Stack>
|
||
|
</PageHeader>
|
||
3 years ago
|
|
||
|
<TextualRoadmap roadmap={roadmap} />
|
||
3 years ago
|
</Box>
|
||
|
|
||
|
<OpensourceBanner />
|
||
|
<UpdatesBanner />
|
||
|
<Footer />
|
||
|
</Box>
|
||
|
);
|
||
|
}
|
||
3 years ago
|
|
||
|
type StaticPathItem = {
|
||
|
params: {
|
||
|
roadmap: string
|
||
|
}
|
||
|
};
|
||
|
|
||
|
export async function getStaticPaths() {
|
||
|
const roadmaps = getAllRoadmaps();
|
||
|
const paramsList: StaticPathItem[] = roadmaps.map(roadmap => ({
|
||
|
params: { 'roadmap': roadmap.id }
|
||
|
}));
|
||
|
|
||
|
return {
|
||
|
paths: paramsList,
|
||
|
fallback: false
|
||
|
};
|
||
|
}
|
||
|
|
||
|
type ContextType = {
|
||
|
params: {
|
||
|
roadmap: string
|
||
|
}
|
||
|
};
|
||
|
|
||
|
export async function getStaticProps(context: ContextType) {
|
||
|
const roadmapId: string = context?.params?.roadmap;
|
||
|
|
||
|
return {
|
||
|
props: {
|
||
|
roadmap: getRoadmapById(roadmapId)
|
||
|
}
|
||
|
};
|
||
|
}
|