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

113 lines
3.5 KiB
TypeScript
Raw Normal View History

2023-03-20 13:50:01 +00:00
import { Box, IconButton, Tabs, Typography, useMediaQuery, useTheme } from "@mui/material";
import ComplexNavText from "../../components/ComplexNavText";
import SectionWrapper from "../../components/SectionWrapper";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import { useState } from "react";
import AccordionWrapperBasket from "./AccordionWrapper";
2023-03-20 13:50:01 +00:00
import TotalPrice from "../../components/TotalPrice";
interface TabPanelProps {
2023-03-20 13:50:01 +00:00
index: number;
value: number;
children?: React.ReactNode;
mt: string;
}
function TabPanel({ index, value, children, mt }: TabPanelProps) {
2023-03-20 13:50:01 +00:00
return (
<Box
hidden={index !== value}
sx={{ mt }}
>
{children}
</Box>
);
}
const contentBasket = [
2023-03-20 13:50:01 +00:00
{
title:"Шаблонизатор",
data:[
["Дисковое хранилище 5 гб", 390],
["Подписка на месяц ", 290],
["200 бесплатных генераций", 590]
]
},
{
title:"Квиз конструктор",
data:[
["Дисковое хранилище 5 гб", 200],
["Подписка на месяц ", 300],
["200 бесплатных генераций", 1000],
]
},
]
export default function BasketPage() {
2023-03-20 13:50:01 +00:00
const theme = useTheme();
const upMd = useMediaQuery(theme.breakpoints.up("md"));
const [tabIndex, setTabIndex] = useState<number>(0);
2023-03-20 13:50:01 +00:00
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setTabIndex(newValue);
};
return (
<SectionWrapper
maxWidth="lg"
sx={{
2023-03-20 13:50:01 +00:00
mt: upMd ? "25px" : "20px",
mb: upMd ? "70px" : "37px",
}}
2023-03-20 13:50:01 +00:00
>
{upMd &&
<ComplexNavText text1="Все тарифы — " text2="Корзина" />
}
<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 variant="h4">Вопросы и ответы</Typography>
</Box>
<TabPanel value={tabIndex} index={0} mt={upMd ? "27px" : "10px"}>
<AccordionWrapperBasket
content={[
{
title:"Шаблонизатор",
data:[
["Дисковое хранилище 5 гб", 390],
["Подписка на месяц ", 290],
["200 бесплатных генераций", 590]
]
},
{
title:"Квиз конструктор",
data:[
["Дисковое хранилище 5 гб", 200],
["Подписка на месяц ", 300],
["200 бесплатных генераций", 1000],
]
},
]}
/>
</TabPanel>
<TotalPrice/>
</SectionWrapper >
);
}
2023-03-20 13:50:01 +00:00