added basic conditional rendering to projects page
This commit is contained in:
parent
271ddbba61
commit
4994dd51ad
@ -7,8 +7,8 @@ import * as Cppdata from "@/data/cppdata.js";
|
||||
function CppProjects() {
|
||||
return (
|
||||
<section id="cpp-projects" className="cpp-projectsContainer">
|
||||
<h2>This is projects area title</h2>
|
||||
<p>This be some projects</p>
|
||||
<h3>This is cpp projects area title</h3>
|
||||
<p>This be some cpp projects</p>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
@ -4,14 +4,15 @@ import "@/components/WebProjects";
|
||||
import "@/components/CppProjects";
|
||||
import WebProjects from "./WebProjects";
|
||||
import CppProjects from "./CppProjects";
|
||||
import { useProjectContext } from "@/context/ProjectContext";
|
||||
|
||||
|
||||
function Projects() {
|
||||
const { typeProject, setTypeProject } = useProjectContext();
|
||||
return (
|
||||
<article id="projects" className="projectsContainer">
|
||||
|
||||
<WebProjects />
|
||||
<CppProjects />
|
||||
{typeProject === "web" && <WebProjects />}
|
||||
{typeProject === "cpp" && <CppProjects />}
|
||||
</article>
|
||||
);
|
||||
};
|
||||
|
||||
@ -3,12 +3,11 @@ import "@/styles/projects.css";
|
||||
import * as Webdata from "@/data/webdata.js";
|
||||
|
||||
|
||||
|
||||
function WebProjects() {
|
||||
return (
|
||||
<section id="webprojects" className="webprojectsContainer">
|
||||
<h2>This is projects area title</h2>
|
||||
<p>This be some projects</p>
|
||||
<h3>This is Web projects area title</h3>
|
||||
<p>This be some web projects</p>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
@ -6,9 +6,9 @@ import { createContext, useState, useContext } from "react";
|
||||
const ProjectContext = createContext();
|
||||
|
||||
export default function ProjectContextProvider({ children }) {
|
||||
|
||||
const [typeProject, setTypeProject] = useState("web");
|
||||
return (
|
||||
<ProjectContext.Provider value = {{}}>
|
||||
<ProjectContext.Provider value = {{typeProject, setTypeProject}}>
|
||||
{children}
|
||||
</ProjectContext.Provider>
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user