add home page and projects page
This commit is contained in:
parent
17f3b1aa1c
commit
78dec2a053
11
README.md
11
README.md
@ -1,15 +1,10 @@
|
||||
# To do
|
||||
|
||||
## For V1 :
|
||||
- Revoir les titres de section (+espace au dessus des titres)
|
||||
|
||||
## For V2 :
|
||||
- Mettre la base de donnée en place
|
||||
- Refaire en conséquence les choses nécessaires
|
||||
|
||||
## For V3 :
|
||||
- Faire une page pour lister tous les projets
|
||||
- Rafaire l'organisation du projet
|
||||
- Faire une page explicative par projet
|
||||
- Faire du responsive
|
||||
- Refaire la section des skills
|
||||
|
||||
|
||||
## Usefull commands
|
||||
|
||||
56
package-lock.json
generated
56
package-lock.json
generated
@ -9,7 +9,8 @@
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
"react-dom": "^19.1.0",
|
||||
"react-router-dom": "^7.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.25.0",
|
||||
@ -1600,6 +1601,15 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz",
|
||||
"integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
@ -2471,6 +2481,44 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-router": {
|
||||
"version": "7.8.2",
|
||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.8.2.tgz",
|
||||
"integrity": "sha512-7M2fR1JbIZ/jFWqelpvSZx+7vd7UlBTfdZqf6OSdF9g6+sfdqJDAWcak6ervbHph200ePlu+7G8LdoiC3ReyAQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cookie": "^1.0.1",
|
||||
"set-cookie-parser": "^2.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-router-dom": {
|
||||
"version": "7.8.2",
|
||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.8.2.tgz",
|
||||
"integrity": "sha512-Z4VM5mKDipal2jQ385H6UBhiiEDlnJPx6jyWsTYoZQdl5TrjxEV2a9yl3Fi60NBJxYzOTGTTHXPi0pdizvTwow==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"react-router": "7.8.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
@ -2544,6 +2592,12 @@
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/set-cookie-parser": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz",
|
||||
"integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
"react-dom": "^19.1.0",
|
||||
"react-router-dom": "^7.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.25.0",
|
||||
|
||||
19
src/App.jsx
19
src/App.jsx
@ -1,20 +1,15 @@
|
||||
import './App.css'
|
||||
import Home from './components/Home.jsx'
|
||||
import Experiences from './components/Experiences.jsx'
|
||||
import Projects from './components/Projects.jsx'
|
||||
import Skills from './components/Skills.jsx'
|
||||
import Footer from './components/Footer.jsx'
|
||||
import { Routes, Route, Link } from 'react-router-dom';
|
||||
import HomePage from './pages/HomePage.jsx';
|
||||
import ProjectsPage from './pages/ProjectsPage';
|
||||
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<Home/>
|
||||
<Experiences />
|
||||
<Projects />
|
||||
<Skills />
|
||||
<Footer />
|
||||
</div>
|
||||
<Routes>
|
||||
<Route path="/" element={<HomePage />} />
|
||||
<Route path="/projets" element={<ProjectsPage />} />
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -10,14 +10,14 @@ function Experiences() {
|
||||
useEffect(() => {
|
||||
const fetchExperiencesAndTasks = async () => {
|
||||
try {
|
||||
let response = await fetch('/api/experiences');
|
||||
let response = await fetch('/api/experiences/');
|
||||
if (!response.ok) {
|
||||
throw new Error(`Erreur HTTP: ${response.status}`);
|
||||
}
|
||||
let data = await response.json();
|
||||
setExperiences(data.data);
|
||||
|
||||
response = await fetch('/api/experienceTasks');
|
||||
response = await fetch('/api/experienceTasks/');
|
||||
if (!response.ok) {
|
||||
throw new Error(`Erreur HTTP: ${response.status}`);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import SingleProject from "./SingleProject.jsx";
|
||||
import "../styles/Projects.css"
|
||||
import React, {useEffect, useState} from "react";
|
||||
import {Link} from "react-router-dom";
|
||||
function Projects() {
|
||||
const [projects, setProjects] = useState([]);
|
||||
const [error, setError] = useState(null);
|
||||
@ -8,7 +9,7 @@ function Projects() {
|
||||
useEffect(() => {
|
||||
const fetchProjects = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/projects');
|
||||
const response = await fetch('/api/projects/');
|
||||
if (!response.ok) {
|
||||
throw new Error(`Erreur HTTP: ${response.status}`);
|
||||
}
|
||||
@ -35,9 +36,7 @@ function Projects() {
|
||||
))}
|
||||
</div>
|
||||
<div className="show-more-container">
|
||||
<p className="show-more-link">
|
||||
Show more
|
||||
</p>
|
||||
<Link to="/projets" className="show-more-link">Show more</Link>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
@ -9,7 +9,7 @@ function Skills() {
|
||||
useEffect(() => {
|
||||
const fetchSkills = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/skills');
|
||||
const response = await fetch('/api/skills/');
|
||||
if (!response.ok) {
|
||||
throw new Error(`Erreur HTTP: ${response.status}`);
|
||||
}
|
||||
|
||||
@ -2,9 +2,12 @@ import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.jsx'
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
|
||||
createRoot(document.getElementById('root')).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</StrictMode>,
|
||||
)
|
||||
|
||||
17
src/pages/HomePage.jsx
Normal file
17
src/pages/HomePage.jsx
Normal file
@ -0,0 +1,17 @@
|
||||
import Home from '../components/Home.jsx'
|
||||
import Experiences from '../components/Experiences.jsx'
|
||||
import Projects from '../components/Projects.jsx'
|
||||
import Skills from '../components/Skills.jsx'
|
||||
import Footer from '../components/Footer.jsx'
|
||||
function HomePage() {
|
||||
return (
|
||||
<div>
|
||||
<Home/>
|
||||
<Experiences/>
|
||||
<Projects/>
|
||||
<Skills/>
|
||||
<Footer/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default HomePage;
|
||||
38
src/pages/ProjectsPage.jsx
Normal file
38
src/pages/ProjectsPage.jsx
Normal file
@ -0,0 +1,38 @@
|
||||
import React, {useEffect, useState} from "react";
|
||||
import SingleProject from "../components/SingleProject.jsx";
|
||||
function ProjectsPage() {
|
||||
const [projects, setProjects] = useState([]);
|
||||
const [error, setError] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchProjects = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/projects/');
|
||||
if (!response.ok) {
|
||||
throw new Error(`Erreur HTTP: ${response.status}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
setProjects(data.data);
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
}
|
||||
};
|
||||
fetchProjects();
|
||||
}, []);
|
||||
|
||||
if (error) {
|
||||
return <div>Erreur lors de la récupération des données : {error}</div>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Voici mes projets</h1>;
|
||||
{projects.map(project => (
|
||||
<SingleProject image={project.image_name} title={project.title} description={project.description} skills={project.skills} color={project.color} nbImage={project.nb_image}/>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default ProjectsPage;
|
||||
Loading…
x
Reference in New Issue
Block a user