feat(mobile): render monthly featured items in 2 columns on mobile

This commit is contained in:
iFixKart Dev 2026-11-16 23:32:10 +05:30
parent ac3590d30a
commit c35fc01b31

View file

@ -538,12 +538,10 @@ export const HotDealsSection: React.FC<HotDealsSectionProps> = ({
{/* ════════ Monthly Featured Item ════════ */} {/* ════════ Monthly Featured Item ════════ */}
<div <div
className="flex-1 min-w-0 flex flex-col" className="flex-1 min-w-0 flex flex-col lg:min-h-[364px]"
style={{ minHeight: BLOCK_H }}
> >
<div <div
className="flex items-center justify-between gap-3 shrink-0 border-b border-[#e5e5e5]" className="flex items-center justify-between gap-3 shrink-0 border-b border-[#e5e5e5] h-[40px]"
style={{ height: FEAT_HEADER }}
> >
<h3 className="text-[15px] font-bold text-[#222] leading-none whitespace-nowrap"> <h3 className="text-[15px] font-bold text-[#222] leading-none whitespace-nowrap">
{featuredTitle} {featuredTitle}
@ -565,12 +563,7 @@ export const HotDealsSection: React.FC<HotDealsSectionProps> = ({
</div> </div>
<div <div
className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 flex-1" className="grid grid-cols-2 lg:grid-cols-3 flex-1 gap-2.5 sm:gap-3.5 mt-3 sm:mt-3.5 sm:auto-rows-[148px]"
style={{
gap: FEAT_GAP,
marginTop: FEAT_TOP_GAP,
gridAutoRows: `${FEAT_CARD_H}px`,
}}
> >
{featuredProducts.map((product) => ( {featuredProducts.map((product) => (
<FeaturedCard key={product.id} product={product} /> <FeaturedCard key={product.id} product={product} />
@ -601,11 +594,10 @@ const FeaturedCard: React.FC<{ product: Product }> = ({ product }) => {
return ( return (
<Link <Link
href={`/products/${product.slug || product.id}`} href={`/products/${product.slug || product.id}`}
className="flex items-center gap-3 px-3 bg-white border border-[#e8e8e8] rounded-[4px] hover:border-[#a8cce8] transition-colors group text-left overflow-hidden h-full" className="flex flex-col sm:flex-row items-center gap-2 sm:gap-3 p-2.5 sm:p-3 bg-white border border-[#e8e8e8] rounded-xl hover:border-[#a8cce8] hover:shadow-xs transition-all group text-left overflow-hidden h-full"
> >
<div <div
className="shrink-0 flex items-center justify-center overflow-hidden" className="shrink-0 flex items-center justify-center overflow-hidden w-full h-[115px] sm:w-[96px] sm:h-[96px] bg-[#fafafa] sm:bg-transparent rounded-lg p-1.5 sm:p-0"
style={{ width: 96, height: 96 }}
> >
{imageUrl ? ( {imageUrl ? (
<div className="relative w-full h-full"> <div className="relative w-full h-full">
@ -614,18 +606,18 @@ const FeaturedCard: React.FC<{ product: Product }> = ({ product }) => {
blurHash={(product as any).blur_hash || null} blurHash={(product as any).blur_hash || null}
alt={product.name} alt={product.name}
fill fill
sizes="96px" sizes="(max-width: 640px) 180px, 96px"
className="max-h-full max-w-full object-contain group-hover:scale-105 transition-transform duration-300" className="max-h-full max-w-full object-contain group-hover:scale-105 transition-transform duration-300"
/> />
</div> </div>
) : ( ) : (
<div className="w-full h-full bg-gray-100" /> <div className="w-full h-full bg-gray-100 rounded" />
)} )}
</div> </div>
<div className="flex-1 min-w-0 flex flex-col justify-center gap-1 py-1"> <div className="w-full flex-1 min-w-0 flex flex-col justify-between sm:justify-center gap-1 py-0.5 sm:py-1 text-left">
<h5 <h5
className="text-[13px] font-bold text-[#222] line-clamp-1 leading-tight group-hover:text-primary transition-colors" className="text-[12px] sm:text-[13px] font-bold text-[#222] line-clamp-2 sm:line-clamp-1 leading-snug group-hover:text-primary transition-colors"
title={product.name} title={product.name}
> >
{product.name} {product.name}
@ -635,16 +627,16 @@ const FeaturedCard: React.FC<{ product: Product }> = ({ product }) => {
<div className="flex items-center gap-1.5 flex-wrap"> <div className="flex items-center gap-1.5 flex-wrap">
{product.oldPrice != null && product.oldPrice > product.price ? ( {product.oldPrice != null && product.oldPrice > product.price ? (
<span className="text-[11px] text-gray-400 line-through"> <span className="text-[10px] sm:text-[11px] text-gray-400 line-through">
{formatCurrency(Number(product.oldPrice))} {formatCurrency(Number(product.oldPrice))}
</span> </span>
) : null} ) : null}
<span className="text-[13px] font-bold text-[#e53935]"> <span className="text-[12px] sm:text-[13px] font-bold text-[#e53935]">
{formatCurrency(Number(product.price))} {formatCurrency(Number(product.price))}
</span> </span>
</div> </div>
<div className="text-[10px] text-gray-400 leading-[1.45]"> <div className="text-[10px] text-gray-400 leading-[1.35] hidden sm:block">
{line1 ? <p className="truncate">{line1}</p> : null} {line1 ? <p className="truncate">{line1}</p> : null}
{line2 ? <p className="truncate">{line2}</p> : null} {line2 ? <p className="truncate">{line2}</p> : null}
</div> </div>