diff --git a/src/app/projects/components/ProjectCard.tsx b/src/app/projects/components/ProjectCard.tsx index f2d6ba66..671e4c45 100644 --- a/src/app/projects/components/ProjectCard.tsx +++ b/src/app/projects/components/ProjectCard.tsx @@ -26,15 +26,14 @@ export default function ProjectCard({ stars, tags, }: Props) { - const [showAllTags, setShowAllTags] = useState(false); const [expandDescription, setExpandDescription] = useState(false); return ( -
+
{/* Top content section */}
-

+

{title}

{parentTitle !== "Upcoming Projects" && stars !== undefined && ( @@ -45,71 +44,46 @@ export default function ProjectCard({ )}
- {/*Description that expands on click */} + {/* Description section with fixed height */}
setExpandDescription(!expandDescription)} + onClick={() => { + if (shortDescription.length > 120) + setExpandDescription(!expandDescription); + }} + style={{ + minHeight: expandDescription ? "auto" : "4.1rem", + }} >

{shortDescription}

- {expandDescription && ( - less + + {/* Only show toggle if the content is long */} + {shortDescription.length > 120 && ( + + {expandDescription ? "less" : "more"} + )}
{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 && ( - - )} + {tag} + + ))}
)} @@ -119,9 +93,9 @@ export default function ProjectCard({ {parentTitle !== "Upcoming Projects" && (githubUrl || documentationUrl) && (githubUrl !== "NA" || documentationUrl !== "NA") && ( -
-
-
+
+
+
{githubUrl && githubUrl !== "NA" && ( (b.stars ?? 0) - (a.stars ?? 0) + ); + return (
@@ -31,7 +35,7 @@ export default function ProjectGrid({ title, projectData }: Props) {
- {projectData.map( + {sortedProjects.map( ( { title: projectTitle,