product: fix count badge

This commit is contained in:
2025-11-11 18:20:17 +03:00
parent 73504dd583
commit 724f201d47
2 changed files with 33 additions and 98 deletions

View File

@@ -493,60 +493,6 @@
fill: #ffffff; fill: #ffffff;
} }
/* Cart badge styles */
.cartBadge {
position: absolute;
top: -8px;
z-index: 2;
color: white;
border-radius: 50%;
min-width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 600;
transition: all 0.3s ease;
border: none;
}
.cartBadge:hover {
transform: scale(1.1);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.cartBadgeRTL {
left: -16px;
}
.cartBadgeLTR {
right: -8px;
}
/* Enhanced responsive cart badge */
@media (min-width: 769px) and (max-width: 1024px) {
.cartBadge {
min-width: 24px;
height: 24px;
font-size: 14px;
}
}
@media (min-width: 1025px) {
.cartBadge {
min-width: 28px;
height: 28px;
font-size: 16px;
}
}
/* RTL support for cart badge */
/* [dir="rtl"] .cartBadge {
right: auto;
left: -8px;
} */
/* Animation for newly added items */ /* Animation for newly added items */
@keyframes badgePulse { @keyframes badgePulse {
0% { 0% {
@@ -560,9 +506,6 @@
} }
} }
.cartBadge.animate {
animation: badgePulse 0.6s ease-in-out;
}
/* Enhanced dark theme animations */ /* Enhanced dark theme animations */
:global(.darkApp) .menuItem, :global(.darkApp) .menuItem,

View File

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