2024-01-02 23:04:17 +01:00
|
|
|
import { useNavigate, useParams } from "react-router-dom";
|
2023-10-12 09:56:13 +02:00
|
|
|
import { useRecoilValue } from "recoil";
|
|
|
|
|
import { projectsAtom } from "../store";
|
|
|
|
|
import ImageGallery from "react-image-gallery";
|
|
|
|
|
import Tags from "../components/Tags";
|
2024-01-02 23:04:17 +01:00
|
|
|
import { IoChevronBackOutline as BackButton } from "react-icons/io5";
|
2023-10-12 09:56:13 +02:00
|
|
|
|
|
|
|
|
function ExperianceDetail() {
|
|
|
|
|
const { id } = useParams();
|
|
|
|
|
const experianceList = useRecoilValue(projectsAtom);
|
2024-01-02 23:04:17 +01:00
|
|
|
const navigate = useNavigate();
|
2023-10-12 09:56:13 +02:00
|
|
|
|
|
|
|
|
//shorter variant of Find function with IF-sats
|
|
|
|
|
const myProject = experianceList.find((item) => item.id === id);
|
|
|
|
|
|
|
|
|
|
if (myProject === undefined) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="container mx-auto my-10 px-6">
|
|
|
|
|
404 the project does not exists
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const projectImg = myProject.img.map((item) => {
|
|
|
|
|
return { original: item, thumbnail: item };
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let linkUI = <></>;
|
|
|
|
|
|
|
|
|
|
if (myProject.link !== undefined) {
|
|
|
|
|
linkUI = (
|
|
|
|
|
<a href={myProject.link} target="_blank">
|
|
|
|
|
Visit page
|
|
|
|
|
</a>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="container mx-auto my-10 px-6">
|
2024-01-02 23:04:17 +01:00
|
|
|
<button
|
2024-01-05 21:57:43 +01:00
|
|
|
className="text-4xl "
|
2024-01-02 23:04:17 +01:00
|
|
|
aria-label="Back"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
navigate(-1);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<BackButton />
|
|
|
|
|
</button>
|
2024-01-05 21:57:43 +01:00
|
|
|
<div className="flex flex-col">
|
2023-10-12 09:56:13 +02:00
|
|
|
<div className="flex-1">
|
2024-01-05 21:57:43 +01:00
|
|
|
<h1 className=" text-subTPhone md:text-subT">
|
|
|
|
|
Project: {myProject.title}
|
|
|
|
|
</h1>
|
2023-10-12 09:56:13 +02:00
|
|
|
</div>
|
2024-01-05 21:57:43 +01:00
|
|
|
<div className="flex-1 mt-2 mb-6">
|
|
|
|
|
<Tags listOfTags={myProject.tags} />
|
|
|
|
|
</div>{" "}
|
2023-10-12 09:56:13 +02:00
|
|
|
</div>
|
2024-01-02 23:04:17 +01:00
|
|
|
<div className="flex flex-col md:flex-row gap-4">
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
<ImageGallery
|
|
|
|
|
showThumbnails={false}
|
|
|
|
|
showBullets={true}
|
|
|
|
|
autoPlay={true}
|
|
|
|
|
slideDuration={1000}
|
|
|
|
|
slideInterval={4000}
|
|
|
|
|
items={projectImg}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-01-05 21:57:43 +01:00
|
|
|
<div className="flex-1 text-base">
|
|
|
|
|
{myProject.info}
|
|
|
|
|
<div className=" drop-shadow-doublelight hover:drop-shadow-light my-2 text-end">
|
|
|
|
|
{linkUI}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>{" "}
|
2023-10-12 09:56:13 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-01-02 23:04:17 +01:00
|
|
|
4;
|
2023-10-12 09:56:13 +02:00
|
|
|
|
|
|
|
|
export default ExperianceDetail;
|