@@ -26,15 +26,14 @@ export default function ProjectCard({
2626 stars,
2727 tags,
2828} : Props ) {
29- const [ showAllTags , setShowAllTags ] = useState ( false ) ;
3029 const [ expandDescription , setExpandDescription ] = useState ( false ) ;
3130
3231 return (
33- < div className = 'border-2 p-8 transition-[box-shadow] shadow-none hover:shadow-xl bg-slate-50/70 max-w-full h-64 flex flex-col relative' >
32+ < div className = 'border-2 p-6 transition-[box-shadow] shadow-none hover:shadow-xl bg-slate-50/70 max-w-full h-64 flex flex-col relative' >
3433 { /* Top content section */ }
3534 < div className = 'flex-1 flex flex-col overflow-hidden' >
3635 < div className = 'flex justify-between items-start mb-3' >
37- < h3 className = 'font-bold text-lg tracking-widest text-mindfire-text-black capitalize truncate pr-2' >
36+ < h3 className = 'font-bold text-lg tracking-widest text-mindfire-text-black capitalize pr-2' >
3837 { title }
3938 </ h3 >
4039 { parentTitle !== "Upcoming Projects" && stars !== undefined && (
@@ -45,71 +44,46 @@ export default function ProjectCard({
4544 ) }
4645 </ div >
4746
48- { /*Description that expands on click */ }
47+ { /* Description section with fixed height */ }
4948 < div
5049 className = { `mb-3 relative cursor-pointer ${
5150 expandDescription ? "max-h-[72px] overflow-y-auto" : ""
5251 } `}
53- onClick = { ( ) => setExpandDescription ( ! expandDescription ) }
52+ onClick = { ( ) => {
53+ if ( shortDescription . length > 120 )
54+ setExpandDescription ( ! expandDescription ) ;
55+ } }
56+ style = { {
57+ minHeight : expandDescription ? "auto" : "4.1rem" ,
58+ } }
5459 >
5560 < p
5661 className = { `text-mf-dark tracking-wide leading-6 ${
57- expandDescription ? "" : "line-clamp-3 "
62+ expandDescription ? "" : "line-clamp-2 "
5863 } `}
5964 >
6065 { shortDescription }
6166 </ p >
62- { expandDescription && (
63- < span className = 'text-xs text-blue-500 mt-1 block' > less</ span >
67+
68+ { /* Only show toggle if the content is long */ }
69+ { shortDescription . length > 120 && (
70+ < span className = 'text-xs text-blue-500 mt-1 block' >
71+ { expandDescription ? "less" : "more" }
72+ </ span >
6473 ) }
6574 </ div >
6675
6776 { parentTitle !== "Upcoming Projects" && tags && tags . length > 0 && (
68- < div className = 'mb-2' >
69- < div
70- className = { `flex gap-2 max-w-full ${
71- showAllTags ? "overflow-x-auto pb-2" : "overflow-hidden"
72- } `}
73- >
74- { showAllTags
75- ? tags . map ( ( tag , index ) => (
76- < span
77- key = { index }
78- className = 'px-2 py-1 text-xs bg-gray-100 text-gray-600 rounded-full border border-red-500 truncate flex-shrink-0'
79- >
80- { tag }
81- </ span >
82- ) )
83- : tags . slice ( 0 , 2 ) . map ( ( tag , index ) => (
84- < span
85- key = { index }
86- className = 'px-2 py-1 text-xs bg-gray-100 text-gray-600 rounded-full border border-red-500 truncate max-w-[100px]'
87- >
88- { tag }
89- </ span >
90- ) ) }
91- { ! showAllTags && tags . length > 2 && (
92- < button
93- onClick = { ( e ) => {
94- e . stopPropagation ( ) ;
95- setShowAllTags ( true ) ;
96- } }
97- className = 'px-2 py-1 text-xs bg-gray-100 text-gray-600 rounded-full hover:bg-gray-200 cursor-pointer'
98- >
99- +{ tags . length - 2 } more
100- </ button >
101- ) }
102- { showAllTags && (
103- < button
104- onClick = { ( e ) => {
105- e . stopPropagation ( ) ;
106- setShowAllTags ( false ) ;
107- } }
108- className = 'px-2 py-1 text-xs bg-gray-100 text-gray-600 rounded-full hover:bg-gray-200 cursor-pointer flex-shrink-0'
77+ < div className = 'mt-1' >
78+ < div className = { `flex gap-2 max-w-full overflow-x-auto pb-2' ` } >
79+ { tags . map ( ( tag , index ) => (
80+ < span
81+ key = { index }
82+ className = 'px-2 py-1 text-xs bg-gray-100 text-gray-600 rounded-full border border-red-500 truncate flex-shrink-0'
10983 >
110- Show less
111- </ button >
112- ) }
84+ { tag }
85+ </ span >
86+ ) ) }
11387 </ div >
11488 </ div >
11589 ) }
@@ -119,9 +93,9 @@ export default function ProjectCard({
11993 { parentTitle !== "Upcoming Projects" &&
12094 ( githubUrl || documentationUrl ) &&
12195 ( githubUrl !== "NA" || documentationUrl !== "NA" ) && (
122- < div className = 'absolute bottom-0 left-0 right-0 mx-8 ' >
123- < div className = 'border-t-2 my-2 ' > </ div >
124- < div className = 'flex gap-4 justify-center my -2' >
96+ < div className = 'mt-2 ' >
97+ < div className = 'border-t-2' > </ div >
98+ < div className = 'flex gap-4 justify-center mt -2' >
12599 { githubUrl && githubUrl !== "NA" && (
126100 < Link
127101 href = { githubUrl }
0 commit comments