Skip to content

Commit 17fbb02

Browse files
Merge pull request #174 from mindfiredigital/dev
Fix horizon and vertical scrolling issue in projects card
2 parents 47892a0 + 6acb6ec commit 17fbb02

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/app/projects/components/ProjectCard.tsx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ export default function ProjectCard({
2929
const [expandDescription, setExpandDescription] = useState(false);
3030

3131
return (
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'>
33-
{/* Top content section */}
32+
<div className='border-2 p-6 transition-[box-shadow] shadow-none hover:shadow-xl bg-slate-50/70 max-w-full h-80 flex flex-col relative'>
3433
<div className='flex-1 flex flex-col overflow-hidden'>
35-
<div className='flex justify-between items-start mb-3'>
36-
<h3 className='font-bold text-lg tracking-widest text-mindfire-text-black capitalize pr-2'>
34+
<div className='flex justify-between items-start mb-2 h-[60px]'>
35+
<h3 className='font-bold text-lg tracking-widest text-mindfire-text-black line-clamp-2 capitalize pr-2 overflow-hidden'>
3736
{title}
3837
</h3>
38+
3939
{parentTitle !== "Upcoming Projects" && stars !== undefined && (
4040
<div className='flex items-center gap-1 bg-gray-100 rounded-full p-1 flex-shrink-0'>
4141
<AiFillStar className='text-yellow-400' />
@@ -44,38 +44,37 @@ export default function ProjectCard({
4444
)}
4545
</div>
4646

47-
{/* Description section with fixed height */}
47+
{/* Description - fixed height with toggleable expansion */}
4848
<div
49-
className={`mb-3 relative cursor-pointer ${
50-
expandDescription ? "max-h-[72px] overflow-y-auto" : ""
51-
}`}
49+
className={`relative cursor-pointer transition-all duration-300 h-[90px] ${
50+
expandDescription
51+
? "max-h-[90px] overflow-y-auto"
52+
: "max-h-[5.5rem] overflow-hidden"
53+
} mb-4`}
5254
onClick={() => {
5355
if (shortDescription.length > 120)
5456
setExpandDescription(!expandDescription);
5557
}}
56-
style={{
57-
minHeight: expandDescription ? "auto" : "4.1rem",
58-
}}
5958
>
6059
<p
6160
className={`text-mf-dark tracking-wide leading-6 ${
62-
expandDescription ? "" : "line-clamp-2"
61+
expandDescription ? "" : "line-clamp-3"
6362
}`}
6463
>
6564
{shortDescription}
6665
</p>
67-
68-
{/* Only show toggle if the content is long */}
66+
{/* Show toggle outside the paragraph */}
6967
{shortDescription.length > 120 && (
7068
<span className='text-xs text-blue-500 mt-1 block'>
7169
{expandDescription ? "less" : "more"}
7270
</span>
7371
)}
7472
</div>
7573

74+
{/* Tags section - fixed height + horizontal scroll if overflow */}
7675
{parentTitle !== "Upcoming Projects" && tags && tags.length > 0 && (
77-
<div className='mt-1'>
78-
<div className={`flex gap-2 max-w-full overflow-x-auto pb-2' `}>
76+
<div className='h-[2.5rem]'>
77+
<div className='flex gap-2 max-w-full overflow-x-auto pb-1'>
7978
{tags.map((tag, index) => (
8079
<span
8180
key={index}

0 commit comments

Comments
 (0)