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,34 +21,33 @@ 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
<Button style={{
type="primary" position: "fixed",
shape="circle" bottom: "20px",
size={"large"} right: !isRTL ? "auto" : "20px",
icon={<CartIcon />} left: !isRTL ? "20px" : "auto",
onClick={onCartClick} }}
className={`${styles.scrollToTopButton}`} >
style={{ <Badge count={totalItems} size="default">
position: "fixed", <Button
bottom: isMobile ? "100px" : isTablet ? "120px" : "20px", type="primary"
right: !isRTL ? "auto" : "20px", shape="circle"
left: !isRTL ? "20px" : "auto", size={"large"}
zIndex: 1000, icon={<CartIcon />}
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)", onClick={onCartClick}
backgroundColor: className={`${styles.scrollToTopButton}`}
themeName === "dark" ? colors.primary : colors.primary, style={{
borderColor: themeName === "dark" ? colors.primary : colors.primary, boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
width: isMobile ? 48 : 56, backgroundColor:
height: isMobile ? 48 : 56, themeName === "dark" ? colors.primary : colors.primary,
}} borderColor: themeName === "dark" ? colors.primary : colors.primary,
> width: 56,
<Badge height: 56,
count={totalItems} gap: "0", // this overrides antd's gap that is preventing centering icon
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 />