diff --git a/README.md b/README.md index 206383d..7358f93 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ # To do -- Faire une page pour lister tous les projets +- Régler problème de scoll entre page - Rafaire l'organisation du projet +- Rajouter les images manquantes des projects - Faire une page explicative par projet - Faire du responsive + +## Plus tard - Refaire la section des skills +- Ajouter un fonction de filtrage des projects (en fonction de la date, des skills) ## Usefull commands diff --git a/public/assets/images/empty/empty_1.png b/public/assets/images/empty/empty_1.png new file mode 100644 index 0000000..2ad3933 Binary files /dev/null and b/public/assets/images/empty/empty_1.png differ diff --git a/src/App.jsx b/src/App.jsx index 1161c03..3eb8608 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -8,7 +8,7 @@ function App() { return ( } /> - } /> + } /> ) } diff --git a/src/components/Experiences.jsx b/src/components/Experiences.jsx index be29a31..42bad78 100644 --- a/src/components/Experiences.jsx +++ b/src/components/Experiences.jsx @@ -31,7 +31,7 @@ function Experiences() { }, []); if (error) { - return
Erreur lors de la récupération des données : {error}
; + return
Error retrieving data: {error}
; } return ( diff --git a/src/components/NavBar.jsx b/src/components/NavBar.jsx index b9f50ee..323438b 100644 --- a/src/components/NavBar.jsx +++ b/src/components/NavBar.jsx @@ -1,44 +1,51 @@ import { useEffect, useState } from "react"; +import { useNavigate } from "react-router-dom"; import "../styles/NavBar.css"; const NavBar = () => { const [active, setActive] = useState("home-section"); const [isScrolling, setIsScrolling] = useState(false); + const navigate = useNavigate(); + useEffect(() => { - const sections = document.querySelectorAll("section"); - const navHeight = document.querySelector(".navbar")?.offsetHeight + 40 || 120; + if (location.pathname === '/') { + const sections = document.querySelectorAll("section"); + const navHeight = document.querySelector(".navbar")?.offsetHeight + 40 || 120; - const handleScroll = () => { - if (isScrolling) return; + const handleScroll = () => { + if (isScrolling) return; - let current = "home-section"; - sections.forEach((section) => { - const sectionTop = section.offsetTop - navHeight; - if (window.scrollY >= sectionTop) { - current = section.id; - } - }); + let current = "home-section"; + sections.forEach((section) => { + const sectionTop = section.offsetTop - navHeight; + if (window.scrollY >= sectionTop) { + current = section.id; + } + }); + setActive(current); + }; - setActive(current); - }; + window.addEventListener("scroll", handleScroll); + handleScroll(); - window.addEventListener("scroll", handleScroll); - handleScroll(); - - return () => { - window.removeEventListener("scroll", handleScroll); - }; - }, [isScrolling]); + return () => { + window.removeEventListener("scroll", handleScroll); + }; + } + }, [isScrolling, location.pathname]); const handleClick = (id) => { - setActive(id); - setIsScrolling(true); - document.getElementById(id)?.scrollIntoView({ behavior: "smooth" }); - setTimeout(() => setIsScrolling(false), 800); + if (location.pathname === '/') { + setActive(id); + setIsScrolling(true); + document.getElementById(id)?.scrollIntoView({ behavior: "smooth" }); + setTimeout(() => setIsScrolling(false), 800); + } else { + navigate(`/#${id}`); + } }; - return (