front-hub/src/pages/SavedTariffs/index.tsx
2023-08-18 19:39:29 +03:00

51 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { IconButton, Box, Typography, useMediaQuery, useTheme } from "@mui/material";
import SectionWrapper from "../../components/SectionWrapper";
import AccordionWrapper from "./AccordionWrapper";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import { useHistoryTracker } from "@root/utils/hooks/useHistoryTracker";
import { useCart } from "@root/utils/hooks/useCart";
import SaveWrapper from "./SaveWrapper";
export default function Faq() {
const theme = useTheme();
const upMd = useMediaQuery(theme.breakpoints.up("md"));
const cart = useCart();
const handleCustomBackNavigation = useHistoryTracker();
console.log(cart);
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 onClick={handleCustomBackNavigation} sx={{ p: 0, height: "28px", width: "28px", color: "black" }}>
<ArrowBackIcon />
</IconButton>
)}
<Typography variant="h4">Сохраненные тарифы</Typography>
</Box>
<Box mt={upMd ? "27px" : "10px"}>
{cart.services.map(({ serviceKey, tariffs }) =>
serviceKey === "custom"
? tariffs.map(({ privileges }) => <SaveWrapper serviceKey={serviceKey} content={privileges} />)
: null
)}
</Box>
</SectionWrapper>
);
}