Skip to content

Commit e790963

Browse files
committed
refactor: update ProjectCard component with new styles and image handling
- Replaced the user icon with an image for creator representation. - Enhanced layout and styling of project category badges. - Updated image handling for project display using Next.js Image component. - Removed unused props and simplified the bottom section for better clarity.
1 parent fb382e0 commit e790963

1 file changed

Lines changed: 35 additions & 60 deletions

File tree

components/ProjectCard.tsx

Lines changed: 35 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
'use client';
22
import React, { useRef } from 'react';
33
import { Project } from '@/types/project';
4-
import { Clock, User } from 'lucide-react';
54
import { Avatar, AvatarFallback, AvatarImage } from './ui/avatar';
65
import { Badge } from './ui/badge';
7-
import { Button } from './ui/button';
86
import gsap from 'gsap';
97
import { useGSAP } from '@gsap/react';
8+
import Image from 'next/image';
109

1110
interface ProjectCardProps {
1211
project: Project;
@@ -26,10 +25,6 @@ const ProjectCard: React.FC<ProjectCardProps> = ({
2625
project,
2726
creatorName = 'Creator Name',
2827
creatorAvatar,
29-
daysLeft = 23,
30-
votes = { current: 46, total: 100 },
31-
onValidationClick,
32-
onVoteClick,
3328
className = '',
3429
}) => {
3530
const cardRef = useRef<HTMLDivElement>(null);
@@ -129,88 +124,68 @@ const ProjectCard: React.FC<ProjectCardProps> = ({
129124
return (
130125
<div
131126
ref={cardRef}
132-
className={`bg-black rounded-2xl p-3 sm:p-4 w-full max-w-sm mx-auto transition-all duration-300 cursor-pointer group overflow-hidden ${className}`}
127+
className={`bg-[#030303] rounded-[8px] border border-[#2B2B2B] p-3 sm:p-5 w-full max-w-[397px] mx-auto transition-all duration-300 cursor-pointer group overflow-hidden ${className}`}
133128
>
134-
{/* Top Section - Creator Info and Category */}
135129
<div className='flex items-center justify-between mb-3 sm:mb-4'>
136130
<div className='flex items-center space-x-2 sm:space-x-3'>
137-
<Avatar className='w-8 h-8 sm:w-10 sm:h-10'>
131+
<Avatar className='w-8 h-8 sm:w-6 sm:h-6'>
138132
<AvatarImage src={creatorAvatar} alt={creatorName} />
139133
<AvatarFallback className='bg-gray-700 text-white'>
140-
<User className='w-4 h-4 sm:w-5 sm:h-5' />
134+
<Image
135+
src='/globe.svg'
136+
alt={creatorName}
137+
width={24}
138+
height={24}
139+
/>
141140
</AvatarFallback>
142141
</Avatar>
143142
<span className='text-gray-300 text-xs sm:text-sm font-medium truncate max-w-24 sm:max-w-none'>
144143
{creatorName}
145144
</span>
146145
</div>
147-
<Badge className='bg-[#4A5D23] text-[#F7E98E] px-2 py-1 sm:px-3 sm:py-1 rounded-lg text-xs font-medium flex-shrink-0'>
148-
{project.category}
149-
</Badge>
146+
<div className='flex items-center space-x-2'>
147+
<Badge className='bg-[#E4DBDB] border border-[#645D5D] text-[#645D5D] px-1 py-0.5 rounded-[4px] text-xs font-medium flex-shrink-0'>
148+
{project.category}
149+
</Badge>
150+
<Badge className='bg-[rgba(167,249,80,0.08)] border border-[#A7F950] text-[#A7F950] px-1 py-0.5 rounded-[4px] text-xs font-medium flex-shrink-0'>
151+
{project.category}
152+
</Badge>
153+
</div>
150154
</div>
151155

152-
{/* Middle Section - Image and Content Side by Side */}
153156
<div
154157
ref={imageRef}
155158
className='flex items-start space-x-3 sm:space-x-4 mb-3 sm:mb-4'
156159
>
157-
{/* Image on the left */}
158-
<div className='relative h-24 w-24 sm:h-32 sm:w-32 rounded-xl overflow-hidden bg-gradient-to-br from-[#D4AF37] to-[#B8860B] flex-shrink-0'>
159-
{/* 3D Ethereum Logo and Architectural Elements */}
160-
<div className='absolute inset-0 flex items-center justify-center'>
161-
<div className='relative w-16 h-16 sm:w-20 sm:h-20'>
162-
{/* Architectural elements */}
163-
<div className='absolute left-0 top-1/2 transform -translate-y-1/2 w-6 h-8 sm:w-8 sm:h-10 bg-gray-800 rounded-l-full opacity-60'></div>
164-
<div className='absolute right-0 top-1/2 transform -translate-y-1/2 w-6 h-8 sm:w-8 sm:h-10 bg-gray-800 rounded-r-full opacity-60'></div>
165-
166-
{/* Ethereum Logo */}
167-
<div className='absolute inset-0 flex items-center justify-center'>
168-
<div className='w-8 h-8 sm:w-10 sm:h-10 bg-gradient-to-br from-gray-300 to-gray-500 rounded-lg transform rotate-45 flex items-center justify-center'>
169-
<div className='w-4 h-4 sm:w-5 sm:h-5 bg-gradient-to-br from-gray-100 to-gray-300 rounded transform -rotate-45'></div>
170-
</div>
171-
</div>
172-
</div>
173-
</div>
160+
<div className='relative h-24 w-24 sm:h-[90px] sm:w-[80px] border rounded-xl overflow-hidden flex-shrink-0'>
161+
<Image
162+
src='/auth/bg.png'
163+
alt={project.name}
164+
fill
165+
className='object-cover'
166+
/>
174167
</div>
175168

176-
{/* Content on the right */}
177-
<div ref={contentRef} className='flex-1 min-w-0'>
178-
<h3 className='text-white text-lg sm:text-xl font-bold mb-2 line-clamp-1'>
169+
<div ref={contentRef} className='flex-1 min-w-0 text-left'>
170+
<h3 className='text-white text-lg sm:text-base font-bold mb-2 line-clamp-1'>
179171
{project.name}
180172
</h3>
181-
<p className='text-gray-300 text-xs sm:text-sm leading-relaxed line-clamp-2 sm:line-clamp-3'>
173+
<p className='text-gray-300 text-xs sm:text-sm text-left leading-relaxed line-clamp-2 sm:line-clamp-3'>
182174
{project.description}
183175
</p>
184176
</div>
185177
</div>
186178

187-
{/* Bottom Section - Actions and Info */}
188-
<div
189-
ref={bottomRef}
190-
className='flex flex-col sm:flex-row sm:items-center sm:justify-between space-y-3 sm:space-y-0'
191-
>
192-
<div className='flex items-center space-x-2 sm:space-x-4'>
193-
<Button
194-
onClick={onValidationClick}
195-
className='bg-[#1E3A8A] hover:bg-[#1E40AF] text-white px-3 py-2 sm:px-4 sm:py-2 rounded-lg text-xs sm:text-sm font-medium flex items-center space-x-1 sm:space-x-2 transition-colors duration-200'
196-
>
197-
<Clock className='w-3 h-3 sm:w-4 sm:h-4' />
198-
<span>Validation</span>
199-
</Button>
200-
<span className='text-gray-300 text-xs sm:text-sm whitespace-nowrap'>
201-
{daysLeft} days left
179+
<div ref={bottomRef} className='flex flex-col gap-2'>
180+
<div className='flex items-center justify-between space-x-2'>
181+
<div className='flex items-center space-x-2'>
182+
<span className='text-white text-xs sm:text-sm'>120/300 USDC</span>
183+
<span className='text-[#B5B5B5] text-xs sm:text-xs'>Raised</span>
184+
</div>
185+
<span className='text-[#F5B546] text-xs sm:text-xs'>
186+
15 days to deadline
202187
</span>
203188
</div>
204-
205-
<div className='flex items-center space-x-2'>
206-
<div className='w-px h-4 sm:h-6 bg-white opacity-30'></div>
207-
<Button
208-
onClick={onVoteClick}
209-
className='bg-[#1E3A8A] hover:bg-[#1E40AF] text-white px-3 py-2 sm:px-4 sm:py-2 rounded-lg text-xs sm:text-sm font-medium transition-colors duration-200'
210-
>
211-
{votes.current}/{votes.total} votes
212-
</Button>
213-
</div>
214189
</div>
215190
</div>
216191
);

0 commit comments

Comments
 (0)