menu: fix footer icons

This commit is contained in:
2025-10-09 17:22:10 +03:00
parent 0b0b80d0d5
commit 905367899e
4 changed files with 31 additions and 35 deletions

View File

@@ -13,7 +13,6 @@
:global(.darkApp) .scrollToTopButton { :global(.darkApp) .scrollToTopButton {
background-color: var(--primary) !important; background-color: var(--primary) !important;
border-color: var(--primary) !important; border-color: var(--primary) !important;
color: #000000 !important;
} }
:global(.darkApp) .scrollToTopButton:hover { :global(.darkApp) .scrollToTopButton:hover {

View File

@@ -6,9 +6,9 @@ interface CartType {
const CartIcon = ({ className, onClick }: CartType) => { const CartIcon = ({ className, onClick }: CartType) => {
return ( return (
<svg <svg
width="17" width="22px"
height="16" height="22px"
viewBox="0 0 17 16" viewBox="0 0 16 16"
fill="none" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
className={className} className={className}

View File

@@ -1,7 +1,6 @@
import { Badge, Button } from "antd"; import { Badge, Button } from "antd";
import CartIcon from "components/Icons/cart/CartIcon"; import CartIcon from "components/Icons/cart/CartIcon";
import { selectCartItems } from "features/order/orderSlice"; import { selectCartItems } from "features/order/orderSlice";
import useBreakPoint from "hooks/useBreakPoint";
import { useCallback } from "react"; import { useCallback } from "react";
import { useNavigate, useParams } from "react-router-dom"; import { useNavigate, useParams } from "react-router-dom";
import { useAppSelector } from "redux/hooks"; import { useAppSelector } from "redux/hooks";
@@ -11,7 +10,6 @@ import styles from "./CartButton.module.css";
export function CartButton() { export function CartButton() {
const { isRTL } = useAppSelector((state) => state.locale); const { isRTL } = useAppSelector((state) => state.locale);
const { themeName } = useAppSelector((state) => state.theme); const { themeName } = useAppSelector((state) => state.theme);
const { isMobile, isTablet } = useBreakPoint();
const { id } = useParams(); const { id } = useParams();
const navigate = useNavigate(); const navigate = useNavigate();
const items = useAppSelector(selectCartItems); const items = useAppSelector(selectCartItems);
@@ -23,7 +21,15 @@ export function CartButton() {
const totalItems = items.reduce((sum, item) => sum + item.quantity, 0); const totalItems = items.reduce((sum, item) => sum + item.quantity, 0);
return ( return (
<> <div
style={{
position: "fixed",
bottom: "20px",
right: !isRTL ? "auto" : "20px",
left: !isRTL ? "20px" : "auto",
}}
>
<Badge count={totalItems} size="default">
<Button <Button
type="primary" type="primary"
shape="circle" shape="circle"
@@ -32,25 +38,16 @@ export function CartButton() {
onClick={onCartClick} onClick={onCartClick}
className={`${styles.scrollToTopButton}`} className={`${styles.scrollToTopButton}`}
style={{ style={{
position: "fixed",
bottom: isMobile ? "100px" : isTablet ? "120px" : "20px",
right: !isRTL ? "auto" : "20px",
left: !isRTL ? "20px" : "auto",
zIndex: 1000,
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)", boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
backgroundColor: backgroundColor:
themeName === "dark" ? colors.primary : colors.primary, themeName === "dark" ? colors.primary : colors.primary,
borderColor: themeName === "dark" ? colors.primary : colors.primary, borderColor: themeName === "dark" ? colors.primary : colors.primary,
width: isMobile ? 48 : 56, width: 56,
height: isMobile ? 48 : 56, height: 56,
gap: "0", // this overrides antd's gap that is preventing centering icon
}} }}
>
<Badge
count={totalItems}
size="default"
style={{ position: "absolute", top: -35, right: -18 }}
/> />
</Button> </Badge>
</> </div>
); );
} }

View File

@@ -73,7 +73,7 @@ export function MenuFooter() {
<span <span
style={{ style={{
position: "relative", position: "relative",
top: 2, top: 4,
}} }}
> >
<CartIcon /> <CartIcon />