dev #20
@ -1,29 +1,28 @@
|
|||||||
import SingleProject from "./SingleProject.jsx";
|
import SingleProject from "./SingleProject.jsx";
|
||||||
import "../styles/Projects.css"
|
import "../styles/Projects.css"
|
||||||
|
import React, {useEffect, useState} from "react";
|
||||||
function Projects() {
|
function Projects() {
|
||||||
const codevProject = {
|
const [projects, setProjects] = useState([]);
|
||||||
title: "Codev",
|
const [error, setError] = useState(null);
|
||||||
image: "codev",
|
|
||||||
color: "orange",
|
useEffect(() => {
|
||||||
nbImage: 5,
|
const fetchProjects = async () => {
|
||||||
skills: ['HTML', 'CSS', 'PHP', 'JavaScript', 'SQL'],
|
try {
|
||||||
description: "A collaborative platform where developers can create, share, and grow coding projects. Built for solo makers or teams, it features real-time messaging and a centralized workspace."
|
const response = await fetch('/api/projects');
|
||||||
}
|
if (!response.ok) {
|
||||||
const SAECProject = {
|
throw new Error(`Erreur HTTP: ${response.status}`);
|
||||||
title: "SAE C++",
|
}
|
||||||
image: "SAE_C++",
|
const data = await response.json();
|
||||||
color: "purple",
|
setProjects(data.data);
|
||||||
nbImage: 3,
|
} catch (err) {
|
||||||
skills: ['C++', 'Git'],
|
setError(err.message);
|
||||||
description: "A C++ program developed for creating and managing treasure hunt records, with a web interface that allows browsing and consulting the entries."
|
}
|
||||||
}
|
};
|
||||||
const proxmoxProject = {
|
fetchProjects();
|
||||||
title: "Proxmox",
|
}, []);
|
||||||
image: "proxmox",
|
|
||||||
color: "green",
|
if (error) {
|
||||||
nbImage: 5,
|
return <div>Erreur lors de la récupération des données : {error}</div>;
|
||||||
skills: [],
|
|
||||||
description: "A Proxmox-based infrastructure that consolidates my personal cloud, home automation, code hosting, media services and web hosting into a single, self-hosted environment."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -31,9 +30,9 @@ function Projects() {
|
|||||||
<section id="projects-section">
|
<section id="projects-section">
|
||||||
<h1 className="section-title">Projects</h1>
|
<h1 className="section-title">Projects</h1>
|
||||||
<div className="projects-section-list">
|
<div className="projects-section-list">
|
||||||
<SingleProject image={codevProject.image} title={codevProject.title} description={codevProject.description} skills={codevProject.skills} color={codevProject.color} nbImage={codevProject.nbImage}/>
|
{projects.map(project => (
|
||||||
<SingleProject image={SAECProject.image} title={SAECProject.title} description={SAECProject.description} skills={SAECProject.skills} color={SAECProject.color} nbImage={SAECProject.nbImage}/>
|
<SingleProject image={project.image_name} title={project.title} description={project.description} skills={project.skills} color={project.color} nbImage={project.nb_image}/>
|
||||||
<SingleProject image={proxmoxProject.image} title={proxmoxProject.title} description={proxmoxProject.description} skills={proxmoxProject.skills} color={proxmoxProject.color} nbImage={proxmoxProject.nbImage}/>
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="show-more-container">
|
<div className="show-more-container">
|
||||||
<p className="show-more-link">
|
<p className="show-more-link">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user