import { useState } from "react"; import { useLocation } from "react-router-dom"; import { Box, Typography, useMediaQuery, useTheme } from "@mui/material"; import SectionWrapper from "@components/SectionWrapper"; import CustomRadioButtons from "@components/CustomRadioButtons"; import FreeTariffCard from "./FreeTariffCard"; import TariffCardTimeAndVolume from "./TariffCardTimeAndVolume"; import { basketStore } from "@root/stores/BasketStore"; import { _mocsk_ } from "@root/__mocks__/CustomRadioButtonsMocks"; import { showCaseObject } from "@root/__mocks__/showCaseObject"; import { IconsCreate } from "@root/lib/IconsCreate"; import ComplexNavText from "@root/components/ComplexNavText"; export default function TariffPage() { const theme = useTheme(); const upMd = useMediaQuery(theme.breakpoints.up("md")); const { add } = basketStore(); const location = useLocation(); const [type, setType] = useState("templ"); const unit: string = String(location.pathname).slice(9); const StepperText: Record = { volume: "Тарифы на объём", time: "Тарифы на время" }; return ( {upMd && } {StepperText[unit]} {showCaseObject[type][unit].map((element, index) => ( } headerText={element.name} text={element.desc} money={element.price} href="" onclick={() => { add({ id: element.id, type: type, obj: element }); }} textButton="выбрать" /> ))} ); }