parent
9827fd8406
commit
250f1d59e6
6 changed files with 60 additions and 12 deletions
@ -0,0 +1,17 @@ |
|||||||
|
[ |
||||||
|
{ |
||||||
|
"title": "Frontend Developer", |
||||||
|
"description": "Roadmap to becoming a frontend developer", |
||||||
|
"slug": "frontend" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "Backend Developer", |
||||||
|
"description": "Roadmap to becoming a backend developer", |
||||||
|
"slug": "backend" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "DevOps", |
||||||
|
"description": "Roadmap for DevOps or any other Operations Role", |
||||||
|
"slug": "devops" |
||||||
|
} |
||||||
|
] |
@ -1,16 +1,19 @@ |
|||||||
import { useRouter } from 'next/router' |
import { useRouter } from 'next/router'; |
||||||
|
import Roadmap from './roadmaps/[roadmap]'; |
||||||
|
import roadmapsList from "../data/roadmaps.json"; |
||||||
|
|
||||||
// Fallback page to handle the routing for the old roadmap pages
|
// Fallback page to handle the old roadmap pages implementation
|
||||||
const Fallback = () => { |
const OldRoadmap = () => { |
||||||
const router = useRouter(); |
const router = useRouter(); |
||||||
const { fallback } = router.query; |
const { fallback } = router.query; |
||||||
|
|
||||||
return ( |
// Render the roadmap if it exists, otherwise 404
|
||||||
<div> |
const roadmapExists = !!roadmapsList.find(roadmap => roadmap.slug === fallback); |
||||||
<h1>{ fallback }</h1> |
if (roadmapExists) { |
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi dolorum ea earum exercitationem fuga magnam nihil nostrum numquam optio provident quaerat repellendus, repudiandae vitae voluptas, voluptatibus. Consequuntur doloremque maxime perferendis!</p> |
return <Roadmap roadmap={ fallback } /> |
||||||
</div> |
} |
||||||
); |
|
||||||
|
return <h1>404</h1>; |
||||||
}; |
}; |
||||||
|
|
||||||
export default Fallback; |
export default OldRoadmap; |
@ -0,0 +1,19 @@ |
|||||||
|
import { useRouter } from 'next/router'; |
||||||
|
import DefaultLayout from '../../layouts/default/index'; |
||||||
|
import PageHeader from '../../components/page-header/index'; |
||||||
|
|
||||||
|
const Roadmap = (props) => { |
||||||
|
const router = useRouter(); |
||||||
|
const { |
||||||
|
roadmap = props.roadmap, |
||||||
|
} = router.query; |
||||||
|
|
||||||
|
return ( |
||||||
|
<DefaultLayout> |
||||||
|
<PageHeader /> |
||||||
|
<p>Show roadmap for { roadmap } here</p> |
||||||
|
</DefaultLayout> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
|
export default Roadmap; |
@ -0,0 +1,11 @@ |
|||||||
|
import DefaultLayout from '../../layouts/default/index'; |
||||||
|
import PageHeader from '../../components/page-header/index'; |
||||||
|
|
||||||
|
const Roadmap = () => ( |
||||||
|
<DefaultLayout> |
||||||
|
<PageHeader /> |
||||||
|
<p>Show all roadmaps here</p> |
||||||
|
</DefaultLayout> |
||||||
|
); |
||||||
|
|
||||||
|
export default Roadmap; |
Loading…
Reference in new issue