forked from th3cyb3rhub/TheCyberHUB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor] Add /opportunities or /resources to Related Page Paths (th…
…3cyb3rhub#710) - Update page paths for pages related to opportunities or resources.
- Loading branch information
1 parent
95f5842
commit 22640f2
Showing
14 changed files
with
1,126 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// const CyberSecurityData = [ | ||
// { | ||
// title: "Cyber Security", | ||
// links: [ | ||
// { | ||
// title: "Cyber Security Tutorial for Beginners", | ||
// url: "https://youtu.be/3QhU9jd03a0", | ||
// target: "_blank", | ||
// }, | ||
// { | ||
// title: "Cyber Security for Beginners", | ||
// url: "https://youtu.be/1S0aBV-Waeo", | ||
// target: "_blank", | ||
// }, | ||
// ], | ||
// }, | ||
// ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import RoadmapsData from "./RoadmapsData"; | ||
import { encodeURL } from "src/components/Blogs/util"; | ||
import { | ||
RedirectLink, | ||
RoadmapContainer, | ||
RoadmapContentHeading, | ||
RoadmapDetails, | ||
RoadmapDetailsCard, | ||
RoadmapDetailsContainer, | ||
RoadmapHeading, | ||
RoadmapHeadingSection, | ||
RoadmapSectionHeading, | ||
} from "./RoadmapElements"; | ||
import { DotSymbol } from "src/components/Homepage/Info/InfoElements"; | ||
import { Checkbox, CheckboxContainer } from "src/components/Courses/LearningPath/LearningPathElements.jsx"; | ||
|
||
const Roadmap = () => { | ||
const { title } = useParams(); | ||
const SelectedRoadmap = RoadmapsData?.find( | ||
(roadmap) => encodeURL(roadmap?.title).toLowerCase() === title.toLowerCase(), | ||
); | ||
|
||
const [checkboxState, setCheckboxState] = useState(() => { | ||
return JSON.parse(localStorage.getItem(`roadmaps-localstorage`)) || {}; | ||
}); | ||
|
||
useEffect(() => { | ||
localStorage.setItem(`roadmaps-localstorage`, JSON.stringify(checkboxState)); | ||
}, [checkboxState, title]); | ||
|
||
const handleCheckboxChange = (section, resource) => { | ||
const newState = { | ||
...checkboxState, | ||
[section]: { | ||
...checkboxState[section], | ||
[resource]: !checkboxState[section]?.[resource], | ||
}, | ||
}; | ||
setCheckboxState(newState); | ||
}; | ||
|
||
return ( | ||
<RoadmapContainer> | ||
<RoadmapHeadingSection> | ||
<RoadmapHeading> {SelectedRoadmap?.title} </RoadmapHeading> | ||
</RoadmapHeadingSection> | ||
|
||
<RoadmapDetailsContainer> | ||
{SelectedRoadmap?.details.map((resources, sectionId) => ( | ||
<RoadmapDetails key={sectionId}> | ||
<RoadmapSectionHeading> {resources?.section} </RoadmapSectionHeading> | ||
{resources?.resources.map((resource, resourceId) => ( | ||
<RoadmapDetailsCard key={resourceId}> | ||
<DotSymbol /> | ||
<RedirectLink href={resource?.url} target={"_blank"}> | ||
<RoadmapContentHeading>{resource?.title}</RoadmapContentHeading> | ||
</RedirectLink> | ||
<CheckboxContainer> | ||
<Checkbox | ||
type="checkbox" | ||
checked={checkboxState[resources.section]?.[resource.title] || false} | ||
onChange={() => handleCheckboxChange(resources.section, resource.title)} | ||
/> | ||
</CheckboxContainer> | ||
</RoadmapDetailsCard> | ||
))} | ||
</RoadmapDetails> | ||
))} | ||
</RoadmapDetailsContainer> | ||
</RoadmapContainer> | ||
); | ||
}; | ||
|
||
export default Roadmap; |
Empty file.
Oops, something went wrong.