add of mobile images, change style and update README.md
This commit is contained in:
@@ -24,7 +24,7 @@ const NavBar = () => {
|
||||
};
|
||||
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
handleScroll(); // check initial
|
||||
handleScroll();
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("scroll", handleScroll);
|
||||
|
||||
@@ -1,13 +1,40 @@
|
||||
import SingleProject from "./SingleProject.jsx";
|
||||
import "../styles/Projects.css"
|
||||
function Projects() {
|
||||
const desc = "A platform for creating and sharing code snippets with a clean and intuitive design. It allows you to create, share, and discover code snippets with ease."
|
||||
const codevProject = {
|
||||
title: "Codev",
|
||||
image: "codev",
|
||||
color: "orange",
|
||||
nbImage: 5,
|
||||
skills: ['HTML', 'CSS', 'PHP', 'JavaScript', 'SQL'],
|
||||
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 SAECProject = {
|
||||
title: "SAE C++",
|
||||
image: "SAE_C++",
|
||||
color: "purple",
|
||||
nbImage: 3,
|
||||
skills: ['C++', 'Git'],
|
||||
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 = {
|
||||
title: "Proxmox",
|
||||
image: "proxmox",
|
||||
color: "green",
|
||||
nbImage: 5,
|
||||
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."
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<section id="projects-section">
|
||||
<h1>Projects</h1>
|
||||
<SingleProject image="landscape" title="Codev" description={desc} skills={['HTML', 'CSS', 'PHP', 'JavaScript', 'SQL']} color="orange" />
|
||||
<SingleProject image="landscape" title="SAE C++" description={desc} skills={['C++', 'Git']} color="purple" />
|
||||
<SingleProject image="proxmox" title="Proxmox" description={desc} skills={[]} color="green" />
|
||||
<div className="projects-section-list">
|
||||
<SingleProject image={codevProject.image} title={codevProject.title} description={codevProject.description} skills={codevProject.skills} color={codevProject.color} nbImage={codevProject.nbImage}/>
|
||||
<SingleProject image={SAECProject.image} title={SAECProject.title} description={SAECProject.description} skills={SAECProject.skills} color={SAECProject.color} nbImage={SAECProject.nbImage}/>
|
||||
<SingleProject image={proxmoxProject.image} title={proxmoxProject.title} description={proxmoxProject.description} skills={proxmoxProject.skills} color={proxmoxProject.color} nbImage={proxmoxProject.nbImage}/>
|
||||
</div>
|
||||
<div className="show-more-container">
|
||||
<p className="show-more-link">
|
||||
Show more
|
||||
|
||||
@@ -1,32 +1,79 @@
|
||||
import SkillCard from './SkillCard';
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import SkillCard from "./SkillCard";
|
||||
import "../styles/SingleProject.css";
|
||||
function SingleProject({image, title, description, skills, color}) {
|
||||
|
||||
function SingleProject({ image, title, description, skills, color, nbImage }) {
|
||||
const [imageID, setImageID] = useState(1);
|
||||
const [isFading, setIsFading] = useState(true);
|
||||
const intervalRef = useRef(null);
|
||||
|
||||
const handleChangeImage = (direction) => {
|
||||
if (nbImage <= 1) return;
|
||||
|
||||
setIsFading(false);
|
||||
|
||||
setTimeout(() => {
|
||||
setImageID((prevID) =>
|
||||
direction === 1
|
||||
? (prevID % nbImage) + 1
|
||||
: prevID === 1 ? nbImage : prevID - 1
|
||||
);
|
||||
setIsFading(true);
|
||||
}, 300);
|
||||
|
||||
clearInterval(intervalRef.current);
|
||||
startAutoSlide();
|
||||
};
|
||||
|
||||
const startAutoSlide = () => {
|
||||
intervalRef.current = setInterval(() => {
|
||||
handleChangeImage(1);
|
||||
}, 5000);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
startAutoSlide();
|
||||
return () => clearInterval(intervalRef.current);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="single-project">
|
||||
<div className="single-project-left">
|
||||
<img src={`/public/assets/images/${image}.png`} alt={image}/>
|
||||
</div>
|
||||
<div className="single-project-middle">
|
||||
<div aria-hidden="true" className={`single-project-line color-${color}`}></div>
|
||||
</div>
|
||||
<div className="single-project-right">
|
||||
<h3 className="single-project-title">{title}</h3>
|
||||
<p className="single-project-description">
|
||||
{description}
|
||||
</p>
|
||||
<ul className="single-project-skills-list">
|
||||
{skills.map(skill => (
|
||||
<li><SkillCard text={skill}/></li>
|
||||
))}
|
||||
</ul>
|
||||
<p className="single-project-link">
|
||||
Learn more
|
||||
</p>
|
||||
<button onClick={() => handleChangeImage(-1)} className="arrow preview">{'<'}</button>
|
||||
|
||||
<img
|
||||
src={`/public/assets/images/${image}/${image}_${imageID}.png`}
|
||||
alt={image}
|
||||
className={isFading ? 'fade-in' : 'fade-out'}
|
||||
/>
|
||||
|
||||
<button onClick={() => handleChangeImage(1)} className="arrow next">{'>'}</button>
|
||||
</div>
|
||||
|
||||
<div className="single-project-right">
|
||||
<div className="single-project-right-top">
|
||||
<div className={`single-project-line color-${color}`}></div>
|
||||
<h3 className="single-project-title">{title}</h3>
|
||||
</div>
|
||||
|
||||
<div className="single-project-right-bottom">
|
||||
<p className="single-project-description" style={{ whiteSpace: "pre-line" }}>
|
||||
{description}
|
||||
</p>
|
||||
|
||||
<ul className="single-project-skills-list">
|
||||
{skills.map((skill) => (
|
||||
<li key={skill}>
|
||||
<SkillCard text={skill} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<p className="single-project-link">Learn more</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default SingleProject
|
||||
export default SingleProject;
|
||||
|
||||
Reference in New Issue
Block a user