-
+
{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 && (
-
{
- e.stopPropagation();
- setShowAllTags(true);
- }}
- className='px-2 py-1 text-xs bg-gray-100 text-gray-600 rounded-full hover:bg-gray-200 cursor-pointer'
- >
- +{tags.length - 2} more
-
- )}
- {showAllTags && (
-
{
- e.stopPropagation();
- setShowAllTags(false);
- }}
- className='px-2 py-1 text-xs bg-gray-100 text-gray-600 rounded-full hover:bg-gray-200 cursor-pointer flex-shrink-0'
+
+
+ {tags.map((tag, index) => (
+
- Show less
-
- )}
+ {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,