diff --git a/src/components/CustomAccordion.tsx b/src/components/CustomAccordion.tsx index 66a9420..ea8e836 100644 --- a/src/components/CustomAccordion.tsx +++ b/src/components/CustomAccordion.tsx @@ -1,11 +1,11 @@ -import { Box, Typography, useMediaQuery, useTheme } from "@mui/material" -import { useState } from "react" -import ExpandIcon from "./icons/ExpandIcon" -import type { ReactNode } from "react" +import { Box, Typography, useMediaQuery, useTheme } from "@mui/material"; +import { useState } from "react"; +import ExpandIcon from "./icons/ExpandIcon"; +import type { ReactNode } from "react"; interface Props { header: ReactNode; - text: string; + text: ReactNode; divide?: boolean; price?: number; last?: boolean; @@ -13,91 +13,94 @@ interface Props { } export default function CustomAccordion({ header, text, divide = false, price, last, first }: Props) { - const theme = useTheme() - const upMd = useMediaQuery(theme.breakpoints.up("md")) - const upXs = useMediaQuery(theme.breakpoints.up("xs")) - const [isExpanded, setIsExpanded] = useState(false) + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); //900 + const upXs = useMediaQuery(theme.breakpoints.up("xs")); //300 + const [isExpanded, setIsExpanded] = useState(false); - return ( - - setIsExpanded((prev) => !prev)} - sx={{ - minHeight: "72px", - px: "20px", - display: "flex", - alignItems: "stretch", - justifyContent: "space-between", - cursor: "pointer", - userSelect: "none", - rowGap: "10px", - flexDirection: upXs ? undefined : "column", - }} - > - - {header} - - - - - - {isExpanded && ( - - - {text} - - - {price} руб. - - - )} - - ) + return ( + + setIsExpanded((prev) => !prev)} + sx={{ + minHeight: "72px", + px: "20px", + display: "flex", + alignItems: "stretch", + justifyContent: "space-between", + cursor: "pointer", + userSelect: "none", + rowGap: "10px", + flexDirection: upXs ? undefined : "column", + }} + > + + {header} + + + + + + {isExpanded && ( + + + {text} + + + {price} руб. + + + )} + + ); } diff --git a/src/pages/Faq/AccordionWrapper.tsx b/src/pages/Faq/AccordionWrapper.tsx index ab17f28..5818a05 100644 --- a/src/pages/Faq/AccordionWrapper.tsx +++ b/src/pages/Faq/AccordionWrapper.tsx @@ -1,24 +1,34 @@ -import { Box } from "@mui/material" +import React from "react"; +import { Box } from "@mui/material"; -import CustomAccordion from "@components/CustomAccordion" -import { cardShadow } from "@root/utils/theme" +import CustomAccordion from "@components/CustomAccordion"; +import { cardShadow } from "@root/utils/theme"; interface Props { content: [string, string][]; } export default function AccordionWrapper({ content }: Props) { - return ( - - {content.map((accordionItem, index) => ( - - ))} - - ) + return ( + + {content.map((accordionItem, index) => ( + ( + + {line} +
+
+ ))} + /> + ))} +
+ ); } diff --git a/src/pages/Faq/Faq.tsx b/src/pages/Faq/Faq.tsx index 1762a83..63a6d91 100644 --- a/src/pages/Faq/Faq.tsx +++ b/src/pages/Faq/Faq.tsx @@ -1,162 +1,171 @@ -import { IconButton, useMediaQuery, useTheme } from "@mui/material" -import { Select } from "@root/components/Select" -import { Box } from "@mui/material" -import { Typography } from "@mui/material" -import { useState } from "react" -import SectionWrapper from "../../components/SectionWrapper" -import AccordionWrapper from "./AccordionWrapper" -import ArrowBackIcon from "@mui/icons-material/ArrowBack" -import { Tabs } from "@root/components/Tabs" -import { useHistoryTracker } from "@root/utils/hooks/useHistoryTracker" +import { IconButton, useMediaQuery, useTheme } from "@mui/material"; +import { Select } from "@root/components/Select"; +import { Box } from "@mui/material"; +import { Typography } from "@mui/material"; +import { useState } from "react"; +import SectionWrapper from "../../components/SectionWrapper"; +import AccordionWrapper from "./AccordionWrapper"; +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { Tabs } from "@root/components/Tabs"; +import { useHistoryTracker } from "@root/utils/hooks/useHistoryTracker"; -const subPages = ["Pena hub", "Шаблоны", "Опросы", "Ссылки", "Финансовые", "Юридические", "Юридические лица"] +const subPages = ["Pena hub", "Шаблоны", "Опросы", "Ссылки", "Финансовые", "Юридические", "Юридические лица"]; export default function Faq() { - const theme = useTheme() - const upMd = useMediaQuery(theme.breakpoints.up("md")) - const isMobile = useMediaQuery(theme.breakpoints.down(550)) - const isTablet = useMediaQuery(theme.breakpoints.down(1000)) - const [tabIndex, setTabIndex] = useState(0) - const [selectedItem, setSelectedItem] = useState(0) + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); + const isMobile = useMediaQuery(theme.breakpoints.down(550)); + const isTablet = useMediaQuery(theme.breakpoints.down(1000)); + const [tabIndex, setTabIndex] = useState(0); + const [selectedItem, setSelectedItem] = useState(0); - const handleCustomBackNavigation = useHistoryTracker() + const handleCustomBackNavigation = useHistoryTracker(); - return ( - - - {isMobile && ( - - - - )} - + return ( + + + {isMobile && ( + + + + )} + Вопросы и ответы - - - - {isMobile ? ( - + ) : ( + + )} + - - - - - - - - - - - - - - - - - - - - - - - ) + + + + + + + + + + + + + + + + + + + + + + + ); } interface TabPanelProps { @@ -167,9 +176,9 @@ interface TabPanelProps { } function TabPanel({ index, value, children, mt }: TabPanelProps) { - return ( - - ) + return ( + + ); }