Add interactive frontend roadmap version

This commit is contained in:
Kamran Ahmed
2021-12-08 14:27:39 +01:00
parent 7cac02f4b4
commit 93b538f4e1
5 changed files with 19 additions and 22 deletions

View File

@ -20,7 +20,7 @@ export function RoadmapError(props: RoadmapProps) {
color='white' color='white'
> >
<Heading mb='4px' size='md'>Oops! There&apos;s an error</Heading> <Heading mb='4px' size='md'>Oops! There&apos;s an error</Heading>
<Text>Try refreshing or <Link target='_blank' fontWeight={700} textDecoration={'underline'} fontSize='14px' href={siteConfig.url.issue}>report a bug</Link> and use the <Link fontWeight={700} textDecoration={'underline'} href={`/${roadmap.id}`}>non-interactive version</Link></Text> <Text>Try refreshing or <Link target='_blank' fontWeight={700} textDecoration={'underline'} fontSize='14px' href={siteConfig.url.issue}>report a bug</Link> and use the <Link fontWeight={700} textDecoration={'underline'} href={`/roadmaps/${roadmap.id}.png`}>non-interactive version</Link></Text>
</Container> </Container>
); );
} }

View File

@ -20,9 +20,6 @@ type RoadmapPageHeaderType = {
export function RoadmapPageHeader(props: RoadmapPageHeaderType) { export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
const { roadmap } = props; const { roadmap } = props;
const router = useRouter()
const isInteractive = router.pathname.includes('/interactive');
return ( return (
<Box <Box
@ -92,22 +89,6 @@ export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
Subscribe Subscribe
</Button> </Button>
</Stack> </Stack>
{roadmap.id === 'frontend' && !isInteractive && (
<Button
d={['none', 'flex', 'flex']}
as={Link}
href={'/frontend/interactive'}
size="xs"
py="14px"
px="10px"
variant="solid"
_hover={{ textDecoration: 'none' }}
colorScheme="purple"
>
<Text as='span' d={['none', 'none', 'inline']}> Interactive Version (Beta)</Text>
<Text as='span' d={['inline', 'inline', 'none']}> Try Beta</Text>
</Button>
)}
</Flex> </Flex>
</Container> </Container>
</Box> </Box>

View File

@ -1 +1,8 @@
# HTML # HTML
HTML stands for Hyper Text Markup Language. It is used on the frontend and gives the structure to the webpage which you can style using CSS and make interactive using JavaScript.
<ResourceGroupTitle>Free Content</ResourceGroupTitle>
<BadgeLink badgeText='Read' href='https://www.w3schools.com/html/html_intro.asp'>W3Schools: Learn HTML</BadgeLink>
<BadgeLink badgeText='Course' colorScheme='green' href='https://www.youtube.com/watch?v=pQN-pnXPaVg'>HTML Full Course - Build a Website Tutorial</BadgeLink>
<BadgeLink badgeText='Course' colorScheme='green' href='https://www.youtube.com/watch?v=qz0aGYrrlhU'>HTML Tutorial for Beginners: HTML Crash Course</BadgeLink>

View File

@ -8,6 +8,7 @@ import { getAllRoadmaps, getRoadmapById, RoadmapType } from '../../lib/roadmap';
import MdRenderer from '../../components/md-renderer'; import MdRenderer from '../../components/md-renderer';
import Helmet from '../../components/helmet'; import Helmet from '../../components/helmet';
import { RoadmapPageHeader } from '../../components/roadmap/roadmap-page-header'; import { RoadmapPageHeader } from '../../components/roadmap/roadmap-page-header';
import { InteractiveRoadmapRenderer } from './interactive';
type RoadmapProps = { type RoadmapProps = {
roadmap: RoadmapType; roadmap: RoadmapType;
@ -15,6 +16,11 @@ type RoadmapProps = {
function ImageRoadmap(props: RoadmapProps) { function ImageRoadmap(props: RoadmapProps) {
const { roadmap } = props; const { roadmap } = props;
if (roadmap.id === 'frontend') {
return <InteractiveRoadmapRenderer roadmap={roadmap} />;
}
if (!roadmap.imageUrl) { if (!roadmap.imageUrl) {
return null; return null;
} }

View File

@ -17,8 +17,11 @@ type RoadmapProps = {
roadmap: RoadmapType; roadmap: RoadmapType;
}; };
function RoadmapRenderer(props: RoadmapProps) { export function InteractiveRoadmapRenderer(props: RoadmapProps) {
const { roadmap } = props; const { roadmap } = props;
if (!roadmap.jsonUrl) {
return null;
}
const { loading: isLoading, error: hasErrorLoading, get } = useFetch(); const { loading: isLoading, error: hasErrorLoading, get } = useFetch();
@ -132,7 +135,7 @@ export default function InteractiveRoadmap(props: RoadmapProps) {
/> />
<Box mb="60px"> <Box mb="60px">
<RoadmapPageHeader roadmap={roadmap} /> <RoadmapPageHeader roadmap={roadmap} />
<RoadmapRenderer roadmap={roadmap} /> <InteractiveRoadmapRenderer roadmap={roadmap} />
</Box> </Box>
<OpensourceBanner /> <OpensourceBanner />