diff --git a/src/app/projects/components/ProjectCard.tsx b/src/app/projects/components/ProjectCard.tsx index 1546d9ab..3d99c630 100644 --- a/src/app/projects/components/ProjectCard.tsx +++ b/src/app/projects/components/ProjectCard.tsx @@ -1,5 +1,7 @@ +'use client' import Link from "next/link"; import React from "react"; +import {useState} from 'react'; import github from "../../../../public/images/social-media/github.png"; import docs from "../../../../public/images/social-media/docs.svg"; import Image from "next/image"; @@ -24,66 +26,124 @@ export default function ProjectCard({ stars, tags, }: Props) { + const [showAllTags, setShowAllTags] = useState(false); + const [expandDescription, setExpandDescription] = useState(false); + return ( -
-
-

- {title} -

- {parentTitle !== "Upcoming Projects" && stars !== undefined && ( -
- - {stars} +
+ {/* Top content section */} +
+
+

+ {title} +

+ {parentTitle !== "Upcoming Projects" && stars !== undefined && ( +
+ + {stars} +
+ )} +
+ + {/*Description that expands on click */} +
setExpandDescription(!expandDescription)} + > +

+ {shortDescription} +

+ {expandDescription && ( + less + )} +
+ + {parentTitle !== "Upcoming Projects" && tags && tags.length > 0 && ( +
+
+ {showAllTags ? ( + tags.map((tag, index) => ( + + {tag} + + )) + ) : ( + tags.slice(0, 2).map((tag, index) => ( + + {tag} + + )) + )} + {!showAllTags && tags.length > 2 && ( + + )} + {showAllTags && ( + + )} +
)}
-

- {shortDescription} -

- {parentTitle !== "Upcoming Projects" && tags && tags.length > 0 && ( -
- {tags.map((tag, index) => ( - - {tag} - - ))} -
- )} + + {/* Footer section */} {parentTitle !== "Upcoming Projects" && (githubUrl || documentationUrl) && (githubUrl !== "NA" || documentationUrl !== "NA") && ( -
- {githubUrl && githubUrl !== "NA" && ( - - Repository - Repository - - )} - {documentationUrl && documentationUrl !== "NA" && ( - - Documentation - Docs - - )} +
+
+
+ {githubUrl && githubUrl !== "NA" && ( + + Repository + Repository + + )} + {documentationUrl && documentationUrl !== "NA" && ( + + Documentation + Docs + + )} +
)}
); + }