product: fix count badge
This commit is contained in:
@@ -230,48 +230,40 @@ export function MenuList({ data, categoryRefs }: MenuListProps) {
|
||||
style={{ width: 24, height: 24 }}
|
||||
/>
|
||||
)}
|
||||
|
||||
<ImageWithFallback
|
||||
src={item.image_small || "/default.png"}
|
||||
fallbackSrc="/default.png"
|
||||
alt={item.name}
|
||||
className={`${styles.popularMenuItemImage} ${
|
||||
isMobile
|
||||
? styles.popularMenuItemImageMobile
|
||||
: isTablet
|
||||
? styles.popularMenuItemImageTablet
|
||||
: styles.popularMenuItemImageDesktop
|
||||
}`}
|
||||
width={90}
|
||||
height={90}
|
||||
/>
|
||||
|
||||
<AddToCartButton />
|
||||
|
||||
{items.some((i) => i.id === item.id) && (
|
||||
<Badge
|
||||
count={
|
||||
items
|
||||
.filter((i) => i.id === item.id)
|
||||
.reduce((total, item) => total + item.quantity, 0)
|
||||
}
|
||||
className={
|
||||
styles.cartBadge +
|
||||
" " +
|
||||
(isRTL
|
||||
? styles.cartBadgeRTL
|
||||
: styles.cartBadgeLTR)
|
||||
}
|
||||
style={{
|
||||
backgroundColor: colors.primary,
|
||||
}}
|
||||
title={`${
|
||||
items
|
||||
.filter((i) => i.id === item.id)
|
||||
.reduce((total, item) => total + item.quantity, 0)
|
||||
} in cart`}
|
||||
<Badge
|
||||
size="default"
|
||||
offset={[-3, 3]}
|
||||
count={items
|
||||
.filter((i) => i.id === item.id)
|
||||
.reduce(
|
||||
(total, item) => total + item.quantity,
|
||||
0,
|
||||
)}
|
||||
color={colors.primary}
|
||||
title={`${items
|
||||
.filter((i) => i.id === item.id)
|
||||
.reduce(
|
||||
(total, item) => total + item.quantity,
|
||||
0,
|
||||
)} in cart`}
|
||||
>
|
||||
<ImageWithFallback
|
||||
src={item.image_small || "/default.png"}
|
||||
fallbackSrc="/default.png"
|
||||
alt={item.name}
|
||||
className={`${styles.popularMenuItemImage} ${
|
||||
isMobile
|
||||
? styles.popularMenuItemImageMobile
|
||||
: isTablet
|
||||
? styles.popularMenuItemImageTablet
|
||||
: styles.popularMenuItemImageDesktop
|
||||
}`}
|
||||
width={90}
|
||||
height={90}
|
||||
/>
|
||||
)}
|
||||
|
||||
<AddToCartButton />
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user