anycoder-6b75aad4 / components /PropertyCard.jsx
ryeisi's picture
Upload components/PropertyCard.jsx with huggingface_hub
beb27a5 verified
Raw History Blame Contribute Delete
2.84 kB
import { Heart, Bed, Bath, Square } from 'lucide-react';
import { useState } from 'react';
export default function PropertyCard({ property }) {
const [isLiked, setIsLiked] = useState(false);
return (
<div className="bg-white rounded-xl shadow-md overflow-hidden hover:shadow-xl transition-shadow duration-300">
<div className="relative">
<img
src={property.image}
alt={property.title}
className="w-full h-48 object-cover"
/>
{property.featured && (
<span className="absolute top-4 left-4 bg-primary-600 text-white px-3 py-1 rounded-full text-sm font-semibold">
Featured
</span>
)}
<button
onClick={() => setIsLiked(!isLiked)}
className="absolute top-4 right-4 bg-white p-2 rounded-full shadow-md hover:shadow-lg transition-shadow"
>
<Heart
className={`w-5 h-5 ${isLiked ? 'fill-red-500 text-red-500' : 'text-gray-600'}`}
/>
</button>
</div>
<div className="p-6">
<div className="flex justify-between items-start mb-2">
<h3 className="text-xl font-semibold text-gray-800">{property.title}</h3>
<span className="text-2xl font-bold text-primary-600">
${property.price.toLocaleString()}
</span>
</div>
<p className="text-gray-600 mb-4 flex items-center gap-1">
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
{property.location}
</p>
<p className="text-gray-500 text-sm mb-4 line-clamp-2">
{property.description}
</p>
<div className="flex items-center justify-between pt-4 border-t">
<div className="flex items-center gap-4 text-gray-600">
<div className="flex items-center gap-1">
<Bed className="w-4 h-4" />
<span className="text-sm">{property.bedrooms} beds</span>
</div>
<div className="flex items-center gap-1">
<Bath className="w-4 h-4" />
<span className="text-sm">{property.bathrooms} baths</span>
</div>
<div className="flex items-center gap-1">
<Square className="w-4 h-4" />
<span className="text-sm">{property.area} sqft</span>
</div>
</div>
</div>
<button className="w-full mt-4 btn-secondary">
View Details
</button>
</div>
</div>
);
}