mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-01-17 14:18:17 +01:00
Add roadmap page
This commit is contained in:
parent
9827fd8406
commit
250f1d59e6
@ -7,7 +7,6 @@ const FeaturedContent = (props) => (
|
||||
<FeaturedWrap className="border-top border-bottom bg-light">
|
||||
<FeaturedRoadmaps />
|
||||
<FeaturedGuides />
|
||||
{ /*<FeaturedJourneys />*/ }
|
||||
</FeaturedWrap>
|
||||
);
|
||||
|
||||
|
@ -11,7 +11,6 @@ const PageHeader = () => (
|
||||
<div className="nav-links">
|
||||
<a href="#">Roadmaps</a>
|
||||
<a href="#">Guides</a>
|
||||
<a href="#">Journeys</a>
|
||||
<a href="#">FAQs</a>
|
||||
<a href="#" className='signup'>Sign Up</a>
|
||||
</div>
|
||||
|
17
data/roadmaps.json
Normal file
17
data/roadmaps.json
Normal file
@ -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
|
||||
const Fallback = () => {
|
||||
// Fallback page to handle the old roadmap pages implementation
|
||||
const OldRoadmap = () => {
|
||||
const router = useRouter();
|
||||
const { fallback } = router.query;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{ fallback }</h1>
|
||||
<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>
|
||||
</div>
|
||||
);
|
||||
// Render the roadmap if it exists, otherwise 404
|
||||
const roadmapExists = !!roadmapsList.find(roadmap => roadmap.slug === fallback);
|
||||
if (roadmapExists) {
|
||||
return <Roadmap roadmap={ fallback } />
|
||||
}
|
||||
|
||||
return <h1>404</h1>;
|
||||
};
|
||||
|
||||
export default Fallback;
|
||||
export default OldRoadmap;
|
19
pages/roadmaps/[roadmap].js
Normal file
19
pages/roadmaps/[roadmap].js
Normal file
@ -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;
|
11
pages/roadmaps/index.js
Normal file
11
pages/roadmaps/index.js
Normal file
@ -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…
x
Reference in New Issue
Block a user