fix: refine FeaturedProducts layout, remove shield icon, position tag independently, enlarge product image, and display full first sentence in description
This commit is contained in:
1 parent
8d3a0bfafb
commit
7bc4ca137e
2 files changed
+10
-9
No files matched your search
@@ -36,6 +36,11 @@ function ProductCard({ product, onClick }: { product: Product; key?: string | nu
|
||||
transition={{ duration: 0.5 }}
|
||||
className="group bg-white rounded-3xl border border-medical-gray-200 overflow-hidden hover:shadow-2xl hover:shadow-canina-blue/10 transition-all duration-500 flex flex-col h-full cursor-pointer relative"
|
||||
>
|
||||
{/* Independent Category Tag at the absolute top-right of the card */}
|
||||
<div className="absolute top-4 right-4 z-30 px-3 py-1 bg-white/95 backdrop-blur-md rounded-full border border-medical-gray-200 text-[10px] font-bold text-medical-gray-600 uppercase tracking-widest shadow-sm">
|
||||
{product.category}
|
||||
</div>
|
||||
|
||||
{compatibility && (
|
||||
<div className={`absolute top-16 right-4 z-10 text-[8px] font-black uppercase tracking-widest px-3 py-1 rounded-full shadow-md flex items-center gap-1 ${
|
||||
compatibility.type === 'alert' ? 'bg-amber-100 text-amber-700' :
|
||||
@@ -46,16 +51,13 @@ function ProductCard({ product, onClick }: { product: Product; key?: string | nu
|
||||
</div>
|
||||
)}
|
||||
{/* Product Image Area */}
|
||||
<div className="relative aspect-square bg-medical-gray-50 p-10 flex items-center justify-center overflow-hidden">
|
||||
<div className="relative aspect-square bg-medical-gray-50 p-4 flex items-center justify-center overflow-hidden">
|
||||
<SafeImage
|
||||
src={product.image}
|
||||
alt={product.name}
|
||||
className="w-full h-full group-hover:scale-105 transition-transform duration-500 drop-shadow-2xl"
|
||||
className="w-full h-full group-hover:scale-105 transition-transform duration-500"
|
||||
imgClassName="object-contain"
|
||||
/>
|
||||
<div className="absolute top-4 right-4 px-3 py-1 bg-white/80 backdrop-blur-md rounded-full border border-medical-gray-200 text-[10px] font-bold text-medical-gray-500 uppercase tracking-widest">
|
||||
{product.category}
|
||||
</div>
|
||||
|
||||
{/* Main PDP Link */}
|
||||
<Link href={`/shop/${product.slug || product.id}`} className="absolute inset-0 z-10" />
|
||||
@@ -86,11 +88,10 @@ function ProductCard({ product, onClick }: { product: Product; key?: string | nu
|
||||
|
||||
{/* Content Area */}
|
||||
<div className="p-8 flex flex-col flex-1" onClick={() => router.push(`/shop/${product.slug || product.id}`)}>
|
||||
<div className="flex items-start justify-between mb-3 gap-2">
|
||||
<h3 dir="ltr" className="text-base md:text-lg font-black text-medical-gray-900 group-hover:text-canina-blue transition-colors leading-normal text-left line-clamp-2 min-h-[3.5rem]">
|
||||
<div className="mb-3">
|
||||
<h3 dir="ltr" className="text-base md:text-lg font-black text-medical-gray-900 group-hover:text-canina-blue transition-colors leading-normal text-left line-clamp-2 min-h-[3.5rem] w-full">
|
||||
{product.name}
|
||||
</h3>
|
||||
<ShieldCheck className="w-6 h-6 text-canina-blue flex-shrink-0" />
|
||||
</div>
|
||||
|
||||
<p className="text-sm text-medical-gray-500 leading-relaxed mb-6 line-clamp-3 min-h-[4.5rem]">
|
||||
|
||||
@@ -45,7 +45,7 @@ export class ProductService {
|
||||
name: data.name,
|
||||
scientificTagline: data.scientificTagline,
|
||||
description: data.description,
|
||||
shortDescription: data.shortDescription,
|
||||
shortDescription: data.shortDescription || (data.description ? (data.description.split(/[.।]/)[0].trim() + '.') : ''),
|
||||
price: data.priceDisplay || `${data.priceValue.toLocaleString('fa-IR')} تومان`,
|
||||
priceValue: Number(data.priceValue),
|
||||
category: data.category?.name || data.category || CATEGORY_SLUG_TO_NAME[data.categorySlug] || data.categorySlug || '',
|
||||
|
||||
Reference in new issue
Block a user