feat(mobile): render monthly featured items in 2 columns on mobile
This commit is contained in:
parent
ac3590d30a
commit
c35fc01b31
1 changed files with 12 additions and 20 deletions
|
|
@ -538,12 +538,10 @@ export const HotDealsSection: React.FC<HotDealsSectionProps> = ({
|
|||
|
||||
{/* ════════ Monthly Featured Item ════════ */}
|
||||
<div
|
||||
className="flex-1 min-w-0 flex flex-col"
|
||||
style={{ minHeight: BLOCK_H }}
|
||||
className="flex-1 min-w-0 flex flex-col lg:min-h-[364px]"
|
||||
>
|
||||
<div
|
||||
className="flex items-center justify-between gap-3 shrink-0 border-b border-[#e5e5e5]"
|
||||
style={{ height: FEAT_HEADER }}
|
||||
className="flex items-center justify-between gap-3 shrink-0 border-b border-[#e5e5e5] h-[40px]"
|
||||
>
|
||||
<h3 className="text-[15px] font-bold text-[#222] leading-none whitespace-nowrap">
|
||||
{featuredTitle}
|
||||
|
|
@ -565,12 +563,7 @@ export const HotDealsSection: React.FC<HotDealsSectionProps> = ({
|
|||
</div>
|
||||
|
||||
<div
|
||||
className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 flex-1"
|
||||
style={{
|
||||
gap: FEAT_GAP,
|
||||
marginTop: FEAT_TOP_GAP,
|
||||
gridAutoRows: `${FEAT_CARD_H}px`,
|
||||
}}
|
||||
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]"
|
||||
>
|
||||
{featuredProducts.map((product) => (
|
||||
<FeaturedCard key={product.id} product={product} />
|
||||
|
|
@ -601,11 +594,10 @@ const FeaturedCard: React.FC<{ product: Product }> = ({ product }) => {
|
|||
return (
|
||||
<Link
|
||||
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
|
||||
className="shrink-0 flex items-center justify-center overflow-hidden"
|
||||
style={{ width: 96, height: 96 }}
|
||||
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"
|
||||
>
|
||||
{imageUrl ? (
|
||||
<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}
|
||||
alt={product.name}
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full h-full bg-gray-100" />
|
||||
<div className="w-full h-full bg-gray-100 rounded" />
|
||||
)}
|
||||
</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
|
||||
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}
|
||||
>
|
||||
{product.name}
|
||||
|
|
@ -635,16 +627,16 @@ const FeaturedCard: React.FC<{ product: Product }> = ({ product }) => {
|
|||
|
||||
<div className="flex items-center gap-1.5 flex-wrap">
|
||||
{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))}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="text-[13px] font-bold text-[#e53935]">
|
||||
<span className="text-[12px] sm:text-[13px] font-bold text-[#e53935]">
|
||||
{formatCurrency(Number(product.price))}
|
||||
</span>
|
||||
</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}
|
||||
{line2 ? <p className="truncate">{line2}</p> : null}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue