front-hub/src/pages/Cart/Cart.tsx

68 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-08-10 11:55:49 +00:00
import {
Box,
IconButton,
Typography,
useMediaQuery,
useTheme,
} from "@mui/material";
2023-03-21 18:52:19 +00:00
import SectionWrapper from "@components/SectionWrapper";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
2023-03-21 18:52:19 +00:00
import TotalPrice from "@components/TotalPrice";
import CustomWrapper from "./CustomWrapper";
2023-06-30 15:35:31 +00:00
import { useCart } from "@root/utils/hooks/useCart";
2023-08-12 14:55:41 +00:00
export default function Cart() {
2023-08-10 11:55:49 +00:00
const theme = useTheme();
const upMd = useMediaQuery(theme.breakpoints.up("md"));
const cart = useCart();
2023-07-14 12:47:36 +00:00
2023-08-12 14:44:39 +00:00
const totalPriceBeforeDiscounts = cart.priceBeforeDiscounts;
const totalPriceAfterDiscounts = cart.priceAfterDiscounts;
2023-03-24 15:30:58 +00:00
2023-08-10 11:55:49 +00:00
return (
<SectionWrapper
maxWidth="lg"
sx={{
mt: upMd ? "25px" : "20px",
mb: upMd ? "70px" : "37px",
}}
>
<Box
sx={{
mt: "20px",
mb: upMd ? "40px" : "20px",
display: "flex",
gap: "10px",
}}
>
{!upMd && (
<IconButton
sx={{ p: 0, height: "28px", width: "28px", color: "black" }}
>
<ArrowBackIcon />
</IconButton>
)}
<Typography component="h4" variant="h4">
Корзина
</Typography>
</Box>
<Box
sx={{
mt: upMd ? "27px" : "10px",
}}
>
{cart.services.map((serviceData) => (
<CustomWrapper
key={serviceData.serviceKey}
serviceData={serviceData}
/>
))}
</Box>
<TotalPrice
priceBeforeDiscounts={totalPriceBeforeDiscounts}
priceAfterDiscounts={totalPriceAfterDiscounts}
/>
</SectionWrapper>
);
2023-03-27 12:45:44 +00:00
}