2023-09-03 20:26:08 +07:00
|
|
|
"use client";
|
|
|
|
|
import { useState, useEffect } from "react";
|
|
|
|
|
import jsonData from "../../../json/data.json";
|
2023-09-03 21:21:04 +07:00
|
|
|
|
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
|
import { faGithub } from "@fortawesome/free-brands-svg-icons";
|
|
|
|
|
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
|
2023-09-05 21:39:08 +07:00
|
|
|
import NotFound from "@/app/not-found";
|
|
|
|
|
import Image from "next/image";
|
2023-09-06 16:39:25 +07:00
|
|
|
import FixedButon from "@/components/FixedButton";
|
|
|
|
|
import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
|
2023-09-03 20:26:08 +07:00
|
|
|
|
2023-12-16 11:47:18 +07:00
|
|
|
// function ScrollDownButton() {
|
|
|
|
|
// render
|
|
|
|
|
|
2023-09-03 20:26:08 +07:00
|
|
|
function Page({ params }) {
|
|
|
|
|
const [data, setData] = useState(null);
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const selectedData = jsonData.Projects.find(
|
|
|
|
|
(item) => item.slug === params.slug
|
|
|
|
|
);
|
2023-09-03 21:21:04 +07:00
|
|
|
if (selectedData === undefined) {
|
|
|
|
|
setData("404");
|
|
|
|
|
} else {
|
|
|
|
|
setData(selectedData);
|
|
|
|
|
}
|
2023-09-03 20:26:08 +07:00
|
|
|
}, [params.slug]);
|
|
|
|
|
|
2023-09-03 21:21:04 +07:00
|
|
|
if (data === "404") {
|
|
|
|
|
return (
|
2023-09-05 21:39:08 +07:00
|
|
|
<>
|
|
|
|
|
<NotFound />
|
|
|
|
|
</>
|
2023-09-03 21:21:04 +07:00
|
|
|
);
|
|
|
|
|
} else if (!data) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 ">
|
|
|
|
|
<div className="min-h-screen flex justify-center items-center w-full">
|
|
|
|
|
<div className="mx-auto grid grid-cols-1 md:grid-cols-2 w-full">
|
|
|
|
|
<div className="flex justify-center items-start flex-col mb-5 space-y-10 w-ful p-4">
|
2023-12-16 11:47:18 +07:00
|
|
|
<div className="animate-pulse bg-neutral-400 h-20 w-full rounded shadow-lg"></div>
|
|
|
|
|
<div className="animate-pulse bg-neutral-400 h-20 w-full rounded shadow-lg"></div>
|
|
|
|
|
<div className="animate-pulse bg-neutral-400 h-20 w-full rounded shadow-lg"></div>
|
|
|
|
|
<div className="animate-pulse bg-neutral-400 h-20 w-full rounded shadow-lg"></div>
|
|
|
|
|
<div className="animate-pulse bg-neutral-400 h-20 w-full rounded shadow-lg"></div>
|
2023-09-03 21:21:04 +07:00
|
|
|
</div>
|
|
|
|
|
<div className="flex justify-start items-start flex-col mb-5 w-full p-4">
|
2023-12-16 11:47:18 +07:00
|
|
|
<div className="animate-pulse duration-500 shadow-lg bg-neutral-400 rounded w-full h-full "></div>
|
2023-09-03 21:21:04 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/* images */}
|
|
|
|
|
<div className="mx-auto grid grid-cols-1 p-5 md:p-20 w-full h-auto">
|
|
|
|
|
<div className="w-full h-auto aspect-video">
|
2023-12-16 11:47:18 +07:00
|
|
|
<div className="animate-pulse duration-500 shadow-lg bg-neutral-400 h-full w-full rounded"></div>
|
2023-09-03 21:21:04 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2023-09-03 20:26:08 +07:00
|
|
|
}
|
2023-09-06 16:39:25 +07:00
|
|
|
const handleBack = () => {
|
|
|
|
|
window.history.back();
|
|
|
|
|
};
|
2023-09-03 20:26:08 +07:00
|
|
|
return (
|
2023-12-16 11:29:56 +07:00
|
|
|
<div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 ">
|
2023-09-06 16:39:25 +07:00
|
|
|
<FixedButon onClick={handleBack}>
|
|
|
|
|
<FontAwesomeIcon
|
|
|
|
|
icon={faChevronLeft}
|
|
|
|
|
className="text-black pr-10"
|
|
|
|
|
/>
|
|
|
|
|
</FixedButon>
|
2023-09-03 20:26:08 +07:00
|
|
|
<div className="min-h-screen flex justify-center items-center">
|
2023-09-03 21:21:04 +07:00
|
|
|
<div className="mx-auto grid grid-cols-1 md:grid-cols-2 mt-10 md:mt-0">
|
2023-12-16 11:29:56 +07:00
|
|
|
<div className="min-h-screen sm:min-h-0 flex justify-center items-start flex-col mb-5 space-y-10 mx-auto">
|
2023-09-03 20:26:08 +07:00
|
|
|
<div>
|
|
|
|
|
<h2 className="uppercase font-normal text-lg tracking-[8px] text-neutral-400">
|
|
|
|
|
Project
|
|
|
|
|
</h2>
|
|
|
|
|
<h1 className="text-4xl font-medium text-neutral-900">
|
|
|
|
|
{data.title}
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<h2 className="uppercase font-normal text-lg tracking-[8px] text-neutral-400">
|
|
|
|
|
Technology
|
|
|
|
|
</h2>
|
|
|
|
|
<p className="text-2xl font-normal text-neutral-900">
|
|
|
|
|
{data.tech.join(", ")}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<h2 className="uppercase font-normal text-lg tracking-[8px] text-neutral-400">
|
|
|
|
|
Year
|
|
|
|
|
</h2>
|
|
|
|
|
<p className="text-2xl font-normal text-neutral-900">
|
|
|
|
|
{data.year}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2023-09-03 21:21:04 +07:00
|
|
|
{data.preview && (
|
|
|
|
|
<div>
|
|
|
|
|
<h2 className="uppercase font-normal text-lg tracking-[8px] text-neutral-400">
|
|
|
|
|
Preview
|
|
|
|
|
</h2>
|
|
|
|
|
<p className="text-2xl font-normal text-neutral-900">
|
|
|
|
|
<a
|
|
|
|
|
href={data.preview}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer">
|
|
|
|
|
Preview{" "}
|
|
|
|
|
<FontAwesomeIcon
|
|
|
|
|
icon={faArrowUpRightFromSquare}
|
|
|
|
|
className="ml-3"
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{data.code && (
|
|
|
|
|
<div>
|
|
|
|
|
<h2 className="uppercase font-normal text-lg tracking-[8px] text-neutral-400">
|
|
|
|
|
Source Code
|
|
|
|
|
</h2>
|
|
|
|
|
<p className="text-2xl font-normal text-neutral-900">
|
|
|
|
|
<a
|
|
|
|
|
href={data.code}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer">
|
|
|
|
|
Github{" "}
|
|
|
|
|
<FontAwesomeIcon
|
|
|
|
|
icon={faGithub}
|
|
|
|
|
className="ml-3"
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2023-09-03 20:26:08 +07:00
|
|
|
</div>
|
|
|
|
|
<div className="flex justify-start items-start flex-col mb-5 ">
|
|
|
|
|
<h2 className="uppercase font-normal text-lg tracking-[8px] text-neutral-400">
|
|
|
|
|
Description
|
|
|
|
|
</h2>
|
|
|
|
|
{data.desc.map((desc, index) => (
|
|
|
|
|
<p
|
|
|
|
|
key={index}
|
2023-09-03 21:21:04 +07:00
|
|
|
className="text-xl text-justify tracking-wide font-normal text-gray-500 mb-5">
|
2023-09-03 20:26:08 +07:00
|
|
|
{desc}
|
|
|
|
|
</p>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/* images */}
|
2023-12-16 11:29:56 +07:00
|
|
|
<div className="mx-auto grid grid-cols-1 p-5 md:p-20 w-full">
|
|
|
|
|
<div className="w-full h-auto text-center flex flex-col justify-center ">
|
2023-09-03 20:26:08 +07:00
|
|
|
{data.images.map((image, index) => (
|
2023-09-05 21:39:08 +07:00
|
|
|
<Image
|
2023-09-03 20:26:08 +07:00
|
|
|
key={index}
|
|
|
|
|
src={image}
|
|
|
|
|
alt={`Project Image ${index + 1}`}
|
2023-12-16 11:47:18 +07:00
|
|
|
className="mb-5 h-auto max-h-screen max-w-7xl mx-auto"
|
2023-09-05 21:39:08 +07:00
|
|
|
width={1920}
|
|
|
|
|
height={1080}
|
2023-12-16 11:47:18 +07:00
|
|
|
layout="responsive"
|
|
|
|
|
objectFit="contain"
|
2023-09-03 20:26:08 +07:00
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Page;
|