diff --git a/app/projects/(project-card)/index.jsx b/app/projects/(project-card)/index.jsx index d1f3942..731439c 100644 --- a/app/projects/(project-card)/index.jsx +++ b/app/projects/(project-card)/index.jsx @@ -1,50 +1,56 @@ import Link from "next/link"; import { motion } from "framer-motion"; import Image from "next/image"; -export default function projectCard({project, index}) { +export default function projectCard({project, index, activeCategory}){ return ( - - - {" "} - {/* Add relative here */} - Alvalens -
-

{project.year}

-
-
-

{project.title}

-

{project.desc}

-
- {project.tech.split(",").map((t, index) => ( - - {t} - - ))} -
-
-
- + <> + {activeCategory == project.category && ( + + + {" "} + {/* Add relative here */} + Alvalens +
+

{project.year}

+
+
+

+ {project.title} +

+

{project.desc}

+
+ {project.tech.split(",").map((t, index) => ( + + {t} + + ))} +
+
+
+ + )} + ); } diff --git a/app/projects/data/projects.js b/app/projects/data/projects.js index bc65527..38bd7c2 100644 --- a/app/projects/data/projects.js +++ b/app/projects/data/projects.js @@ -16,6 +16,7 @@ export const projects = [ tech: "NextJS, Typescript, Gemini AI API, Tailwind CSS, Shadcn UI, Firebase", bg: Trivia, slug: "trivia", + category: 1, }, { title: "Saku Senyum", @@ -24,6 +25,7 @@ export const projects = [ tech: "NextJS, Typescript, Tailwind CSS, Shadcn UI, Prisma, MySQL", bg: SakuSenyum, slug: "saku-senyum", + category: 1, }, { title: "LUDOang", @@ -32,6 +34,7 @@ export const projects = [ tech: "Python, Pygame, OpenGL", bg: LUDOang, slug: "ludoang", + category: 9, }, { title: "React Chat WebApp", @@ -40,6 +43,7 @@ export const projects = [ tech: "Javascript, React Js, Firebase, Daisy UI", bg: ReactChatMain, slug: "react-chat", + category: 1, }, { title: "React Tools", @@ -48,6 +52,7 @@ export const projects = [ tech: "Javascript, React Js, TailwindCSS", bg: ReactTools, slug: "react-tools", + category: 1, }, { title: "Aleph Discord Bot", @@ -56,6 +61,7 @@ export const projects = [ tech: "Python, Serp API, Discord.py", bg: AlephBot, slug: "aleph-discord-bot", + category: 9, }, { title: "LPTK Cup 2023 Website", @@ -64,6 +70,7 @@ export const projects = [ tech: "PHP, Laravel, Bootstrap, JQuery, MySQL", bg: LPTK, slug: "lptk-cup-2023", + category: 1, }, { title: "NU INO Website", @@ -72,5 +79,6 @@ export const projects = [ tech: "PHP, Laravel, Livewire, Bootstrap, JQuery, MySQL", bg: NUINO, slug: "nu-ino-website", + category: 1, }, ]; diff --git a/app/projects/page.jsx b/app/projects/page.jsx index 52e4e55..1b951bd 100644 --- a/app/projects/page.jsx +++ b/app/projects/page.jsx @@ -1,5 +1,5 @@ "use client"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import Link from "next/link"; import { motion } from "framer-motion"; import Button from "@/components/Button"; @@ -20,11 +20,12 @@ import { faChevronLeft } from "@fortawesome/free-solid-svg-icons"; const category = { 1: "Web Development", - 2: "Mobile Development", - 3: "Other", + 9: "Other", } export default function Page() { + const [activeCategory, setActiveCategory] = useState(1); + useEffect(() => { window.scrollTo(0, 0); }, []); @@ -175,7 +176,6 @@ export default function Page() { }} transition={{ delay: 0.5, - type: "spring", }}>

@@ -228,10 +228,36 @@ export default function Page() { + + {/* choose category */} +
+ {Object.keys(category).map((key, index) => ( +
+ setActiveCategory( + key, + console.log(key, activeCategory) + ) + }> + {category[key]} +
+ ))} +
+ + {/* projects */}
- {/* loop projeects data */} {projects.map((project, index) => ( - + ))}
{/* view in archive btn */}