diff --git a/src/components/project.tsx b/src/components/project.tsx index 1bcff6e..e7ff507 100644 --- a/src/components/project.tsx +++ b/src/components/project.tsx @@ -5,7 +5,7 @@ import cn from "@/utils/function"; import { ProjectType } from "@/utils/types"; import { motion } from "framer-motion"; import Image from "next/image"; -import { useState } from "react"; +import { useEffect, useState } from "react"; interface ProjectProps { project: ProjectType; @@ -20,16 +20,58 @@ const anim = { const Project = ({ project, index }: ProjectProps) => { - const [isActive, setIsActive] = useState(false); + const [isMounted, setIsMounted] = useState(false); const isComputerOrLarger = useMediaQuery('(min-width: 1280px)'); + useEffect(() => { + setIsMounted(true); + }, []) + + if(!isMounted) return null; + if(!isComputerOrLarger) { - return + return ( + + + + ) } - return ( + return ( + + + + ) +} + +export default Project; + + +const MobileProject = ({ project, index }: ProjectProps) => { + + return( +
+
+

{project.name}

+
+

{project.date}

+
+ ) +} + +const DesktopProject = ({ project, index }: ProjectProps) => { + + const [isActive, setIsActive] = useState(false); + + return (
{ onMouseLeave={() => {setIsActive(false)}} >
-

{project.name}

+

{project.name}

{

{project.date}

- ); -} - -export default Project; - - -const MobileProject = ({ project, index }: ProjectProps) => { - - return( -
-
-

{project.name}

-
-

{project.date}

-
) } \ No newline at end of file diff --git a/src/components/sections/projects.tsx b/src/components/sections/projects.tsx index 3409377..837019a 100644 --- a/src/components/sections/projects.tsx +++ b/src/components/sections/projects.tsx @@ -4,16 +4,19 @@ import Project from "../project"; const projects = [ { "name": "Pixel War", + "slug": "pixel-war", "date": "2023-2024", "image": "pixelwar.png", }, { "name": "Hacker's Journey", + "slug": "hacker-journey", "date": "2023-2024", "image": "hackerjourney.png", }, { "name": "Forum Associatif", + "slug": "forum-associatif", "date": "2023-2024", "image": "forumassociatif.png", }, diff --git a/src/utils/types.ts b/src/utils/types.ts index a9757c2..cfa4d60 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -6,6 +6,7 @@ export type MemberType = { export type ProjectType = { name: string, + slug: string, date: string, image: string, } \ No newline at end of file