diff --git a/src/components/CustomSlider.tsx b/src/components/CustomSlider.tsx index 6fa8340..e845c6c 100644 --- a/src/components/CustomSlider.tsx +++ b/src/components/CustomSlider.tsx @@ -1,26 +1,69 @@ -import { Slider, SliderProps, styled } from "@mui/material"; +import { useState, useEffect } from "react"; +import { Slider, useTheme } from "@mui/material"; +type CustomSliderProps = { + value: number; + min: number; + max: number; + onChange: (value: number | number[]) => void; +}; -export default styled(Slider)(({ theme }) => ({ - color: theme.palette.brightPurple.main, - height: "12px", - "& .MuiSlider-track": { - border: "none", - }, - "& .MuiSlider-rail": { - backgroundColor: "#F2F3F7", - border: `1px solid ${theme.palette.grey2.main}`, - }, - "& .MuiSlider-thumb": { - height: 32, - width: 32, - border: `6px solid ${theme.palette.brightPurple.main}`, - backgroundColor: "white", - boxShadow: `0px 0px 0px 3px white, - 0px 4px 4px 3px #C3C8DD`, - "&:focus, &:hover, &.Mui-active, &.Mui-focusVisible": { - boxShadow: `0px 0px 0px 3px white, - 0px 4px 4px 3px #C3C8DD`, +export const CustomSlider = ({ + value, + min = 0, + max = 100, + onChange, +}: CustomSliderProps) => { + const theme = useTheme(); + const [step, setStep] = useState(1); + + useEffect(() => { + if (value < 100) { + return setStep(10); + } + + if (value < 500) { + return setStep(20); + } + + if (value < 2000) { + return setStep(50); + } + + setStep(150); + }, [value]); + + return ( + onChange(newValue)} + sx={{ + color: theme.palette.brightPurple.main, + height: "12px", + "& .MuiSlider-track": { + border: "none", }, - }, -})); + "& .MuiSlider-rail": { + backgroundColor: "#F2F3F7", + border: `1px solid ${theme.palette.grey2.main}`, + }, + "& .MuiSlider-thumb": { + height: 32, + width: 32, + border: `6px solid ${theme.palette.brightPurple.main}`, + backgroundColor: "white", + boxShadow: `0px 0px 0px 3px white, + 0px 4px 4px 3px #C3C8DD`, + "&:focus, &:hover, &.Mui-active, &.Mui-focusVisible": { + boxShadow: `0px 0px 0px 3px white, + 0px 4px 4px 3px #C3C8DD`, + }, + }, + }} + /> + ); +}; diff --git a/src/components/CustomWrapperDrawer.tsx b/src/components/CustomWrapperDrawer.tsx index 34f266d..4d9fa1c 100644 --- a/src/components/CustomWrapperDrawer.tsx +++ b/src/components/CustomWrapperDrawer.tsx @@ -2,7 +2,6 @@ import { useState } from "react"; import { Box, SvgIcon, Typography, useMediaQuery, useTheme } from "@mui/material"; import ClearIcon from "@mui/icons-material/Clear"; -import { cardShadow } from "@root/utils/themes/shadow"; import { currencyFormatter } from "@root/utils/currencyFormatter"; import { removeTariffFromCart } from "@root/stores/user"; import { enqueueSnackbar } from "notistack"; @@ -35,7 +34,6 @@ export default function CustomWrapperDrawer({ serviceData }: Props) { sx={{ overflow: "hidden", borderRadius: "12px", - boxShadow: cardShadow, }} > state.summaryPriceAfterDiscountsMap ); + const userAccount = useUserStore((state) => state.userAccount); const basePrice = Object.values(summaryPriceBeforeDiscountsMap).reduce( (a, e) => a + e, @@ -74,7 +72,7 @@ export default function Drawers({ cartItemsAmount = 0 }: DrawersProps) { }} > state.userAccount); const theme = useTheme(); @@ -73,7 +71,7 @@ export default function NavbarCollapsed({ }} > - + navigate("/wallet")} diff --git a/src/components/NumberInputWithUnitAdornment.tsx b/src/components/NumberInputWithUnitAdornment.tsx index 42140bb..4f52928 100644 --- a/src/components/NumberInputWithUnitAdornment.tsx +++ b/src/components/NumberInputWithUnitAdornment.tsx @@ -1,87 +1,98 @@ -import { InputAdornment, TextField, Typography, useTheme } from "@mui/material"; import { useState } from "react"; +import { InputAdornment, TextField, Typography, useTheme } from "@mui/material"; +import type { ChangeEvent } from "react"; interface Props { - id: string; - adornmentText: string; - onChange: (value: number) => void; + id: string; + adornmentText: string; + onChange: (value: number) => void; } -export default function NumberInputWithUnitAdornment({ id, adornmentText, onChange }: Props) { - const theme = useTheme(); - const [valueField, setValueField] = useState(""); +export default function NumberInputWithUnitAdornment({ + id, + adornmentText, + onChange, +}: Props) { + const theme = useTheme(); + const [valueField, setValueField] = useState(""); - return ( - { - let n = parseInt(e.target.value); + return ( + ) => { + const newNumber = parseInt(target.value); - if (!isFinite(n)) n = 0; + if (!isFinite(newNumber) || newNumber < 0) { + onChange(0); + setValueField(String(0)); - onChange(n); - setValueField(n.toString()); - }} + return; + } + + onChange(newNumber); + setValueField(String(newNumber)); + }} + sx={{ + maxWidth: "200px", + minWidth: "200px", + ".MuiInputBase-root": { + pr: 0, + height: "48px", + borderRadius: "8px", + backgroundColor: "#F2F3F7", + fieldset: { + border: "1px solid" + theme.palette.grey2.main, + }, + "&.Mui-focused fieldset": { + borderColor: theme.palette.brightPurple.main, + }, + input: { + height: "31px", + borderRight: !valueField ? "none" : "1px solid #9A9AAF", + }, + "&.Mui-focused input": { + borderRight: "1px solid #9A9AAF", + }, + "&:not(.Mui-focused) .MuiInputAdornment-root": { + display: !valueField ? "none" : undefined, + }, + "&.Mui-focused ::-webkit-input-placeholder": { + color: "transparent", + }, + + // Hiding arrows + "input::-webkit-outer-spin-button, input::-webkit-inner-spin-button": + { + WebkitAppearance: "none", + margin: 0, + }, + "input[type = number]": { + MozAppearance: "textfield", + }, + }, + }} + InputProps={{ + endAdornment: ( + - - {adornmentText} - - - ) - }} - /> - ); + > + + {adornmentText} + + + ), + }} + /> + ); } diff --git a/src/components/templCardPhoneLight.tsx b/src/components/templCardPhoneLight.tsx index 3913453..ae1d963 100644 --- a/src/components/templCardPhoneLight.tsx +++ b/src/components/templCardPhoneLight.tsx @@ -1,4 +1,10 @@ -import {Box, Button, Typography, useMediaQuery, useTheme} from "@mui/material"; +import { + Box, + Button, + Typography, + useMediaQuery, + useTheme, +} from "@mui/material"; import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; import CardWithLink from "@components/CardWithLink"; import UnderlinedLink from "@components/UnderlinedLink"; @@ -9,73 +15,76 @@ import card3Image from "@root/assets/landing/card3.png"; import cardImageBig from "@root/assets/landing/card1big.png"; export default function () { - const theme = useTheme(); - const upMd = useMediaQuery(theme.breakpoints.up("md"));console.log("я узкий") - return - + + + Шаблонизатор + + "Текст- это текст, который имеет некоторые характеристики реального + письменного текст" + + + - - + Подробнее + + -} \ No newline at end of file + ); +} diff --git a/src/components/wideTemplCard.tsx b/src/components/wideTemplCard.tsx index ecbd771..66ac471 100644 --- a/src/components/wideTemplCard.tsx +++ b/src/components/wideTemplCard.tsx @@ -1,4 +1,12 @@ -import {Box, Typography, useMediaQuery, useTheme, Button, SxProps, Theme} from "@mui/material"; +import { + Box, + Typography, + useMediaQuery, + useTheme, + Button, + SxProps, + Theme, +} from "@mui/material"; import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; import CardWithLink from "@components/CardWithLink"; import UnderlinedLink from "@components/UnderlinedLink"; @@ -9,15 +17,17 @@ import card3Image from "@root/assets/landing/card3.png"; import cardImageBig from "@root/assets/landing/card1big.png"; interface Props { - light?: boolean; - sx?: SxProps; + light?: boolean; + sx?: SxProps; } -export default function ({light = true, sx}: Props) { - const theme = useTheme(); - const upMd = useMediaQuery(theme.breakpoints.up("md")); +export default function ({ light = true, sx }: Props) { + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); - return - - Шаблонизатор - Текст- это текст, который имеет некоторые характеристики - реального - письменного текс - { - light ? - - : - } - sx={{ - mt: "auto", - }} - /> - } - - + + Шаблонизатор + + Текст- это текст, который имеет некоторые характеристики реального + письменного текс + + {light ? ( + + ) : ( + + } + sx={{ + mt: "auto", + }} + /> + )} + + -} \ No newline at end of file + ); +} diff --git a/src/pages/Basket/CustomWrapper.tsx b/src/pages/Basket/CustomWrapper.tsx index c8e4e00..d6f12f0 100644 --- a/src/pages/Basket/CustomWrapper.tsx +++ b/src/pages/Basket/CustomWrapper.tsx @@ -1,5 +1,11 @@ import { useState } from "react"; -import { Box, SvgIcon, Typography, useMediaQuery, useTheme } from "@mui/material"; +import { + Box, + SvgIcon, + Typography, + useMediaQuery, + useTheme, +} from "@mui/material"; import ExpandIcon from "@components/icons/ExpandIcon"; import ClearIcon from "@mui/icons-material/Clear"; import { cardShadow } from "@root/utils/themes/shadow"; @@ -8,168 +14,183 @@ import { removeTariffFromCart } from "@root/stores/user"; import { enqueueSnackbar } from "notistack"; import { ServiceCartData, getMessageFromFetchError } from "@frontend/kitui"; - -const name: Record = { templategen: "Шаблонизатор", squiz: "Опросник", reducer: "Сокращатель ссылок" }; +const name: Record = { + templategen: "Шаблонизатор", + squiz: "Опросник", + reducer: "Сокращатель ссылок", +}; interface Props { - serviceData: ServiceCartData; + serviceData: ServiceCartData; } export default function CustomWrapper({ serviceData }: Props) { - const theme = useTheme(); - const upMd = useMediaQuery(theme.breakpoints.up("md")); - const upSm = useMediaQuery(theme.breakpoints.up("sm")); - const [isExpanded, setIsExpanded] = useState(false); + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); + const upSm = useMediaQuery(theme.breakpoints.up("sm")); + const [isExpanded, setIsExpanded] = useState(false); - function handleItemDeleteClick(tariffId: string) { - removeTariffFromCart(tariffId).then(() => { - enqueueSnackbar("Тариф удален"); - }).catch(error => { - const message = getMessageFromFetchError(error); - if (message) enqueueSnackbar(message); - }); - } + function handleItemDeleteClick(tariffId: string) { + removeTariffFromCart(tariffId) + .then(() => { + enqueueSnackbar("Тариф удален"); + }) + .catch((error) => { + const message = getMessageFromFetchError(error); + if (message) enqueueSnackbar(message); + }); + } - return ( + return ( + + setIsExpanded((prev) => !prev)} + sx={{ + height: "72px", + px: "20px", + + display: "flex", + alignItems: "center", + justifyContent: "space-between", + cursor: "pointer", + userSelect: "none", + }} > - + {name[serviceData.serviceKey]} + + + + - setIsExpanded((prev) => !prev)} - sx={{ - height: "72px", - px: "20px", - - display: "flex", - alignItems: "center", - justifyContent: "space-between", - cursor: "pointer", - userSelect: "none", - }} - > - - {name[serviceData.serviceKey]} - - - - - {currencyFormatter.format(serviceData.price / 100)} - - - - - - - {isExpanded && - serviceData.privileges.map(privilege => ( - - - {privilege.description} - - - - {currencyFormatter.format(privilege.price / 100)} - - {upSm ? ( - handleItemDeleteClick(privilege.tariffId)} - sx={{ - color: theme.palette.text.secondary, - borderBottom: `1px solid ${theme.palette.text.secondary}`, - width: "max-content", - lineHeight: "19px", - cursor: "pointer", - }} - > - Удалить - - ) : ( - handleItemDeleteClick(privilege.tariffId)} component={ClearIcon}> - )} - - - ))} + {currencyFormatter.format(serviceData.price / 100)} + + + + - ); + {isExpanded && + serviceData.privileges.map((privilege) => ( + + + {privilege.description} + + + + {currencyFormatter.format(privilege.price / 100)} + + {upSm ? ( + handleItemDeleteClick(privilege.tariffId)} + sx={{ + color: theme.palette.text.secondary, + borderBottom: `1px solid ${theme.palette.text.secondary}`, + width: "max-content", + lineHeight: "19px", + cursor: "pointer", + }} + > + Удалить + + ) : ( + handleItemDeleteClick(privilege.tariffId)} + component={ClearIcon} + sx={{ fill: "#7E2AEA" }} + /> + )} + + + ))} + + + ); } diff --git a/src/pages/Faq/Faq.tsx b/src/pages/Faq/Faq.tsx index 9bea324..484f74c 100644 --- a/src/pages/Faq/Faq.tsx +++ b/src/pages/Faq/Faq.tsx @@ -37,7 +37,7 @@ export default function Faq() { + + - - - Узнайте, как наши сервисы решают ваши задачи - - - Покажут эффективность рекламы - Соберут все обращения клиентов - Повысят конверсию сайта - - } - /> - - + + Покажут эффективность рекламы + Соберут все обращения клиентов + Повысят конверсию сайта + + - - - - ); -} \ No newline at end of file + } + /> + + + + + + ); +} diff --git a/src/pages/TariffConstructor/CustomTariffCard.tsx b/src/pages/TariffConstructor/CustomTariffCard.tsx index 212a3fd..e510383 100644 --- a/src/pages/TariffConstructor/CustomTariffCard.tsx +++ b/src/pages/TariffConstructor/CustomTariffCard.tsx @@ -1,120 +1,144 @@ -import { Box, Divider, Typography, useMediaQuery, useTheme } from "@mui/material"; +import { + Box, + Divider, + Typography, + useMediaQuery, + useTheme, +} from "@mui/material"; import CustomButton from "../../components/CustomButton"; import { Privilege } from "@root/model/privilege"; import TariffPrivilegeSlider from "./TariffItem"; -import { createAndSendTariff, useCustomTariffsStore } from "@root/stores/customTariffs"; +import { + createAndSendTariff, + useCustomTariffsStore, +} from "@root/stores/customTariffs"; import { cardShadow } from "@root/utils/themes/shadow"; import { currencyFormatter } from "@root/utils/currencyFormatter"; import { devlog, getMessageFromFetchError } from "@frontend/kitui"; import { enqueueSnackbar } from "notistack"; - interface Props { - serviceKey: string; - privileges: Privilege[]; + serviceKey: string; + privileges: Privilege[]; } export default function CustomTariffCard({ serviceKey, privileges }: Props) { - const theme = useTheme(); - const upMd = useMediaQuery(theme.breakpoints.up("md")); - const summaryPriceBeforeDiscounts = useCustomTariffsStore(state => state.summaryPriceBeforeDiscountsMap); - const summaryPriceAfterDiscounts = useCustomTariffsStore(state => state.summaryPriceAfterDiscountsMap); + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); + const summaryPriceBeforeDiscounts = useCustomTariffsStore( + (state) => state.summaryPriceBeforeDiscountsMap + ); + const summaryPriceAfterDiscounts = useCustomTariffsStore( + (state) => state.summaryPriceAfterDiscountsMap + ); - const priceBeforeDiscounts = summaryPriceBeforeDiscounts[serviceKey] ?? 0; - const priceAfterDiscounts = summaryPriceAfterDiscounts[serviceKey] ?? 0; + const priceBeforeDiscounts = summaryPriceBeforeDiscounts[serviceKey] ?? 0; + const priceAfterDiscounts = summaryPriceAfterDiscounts[serviceKey] ?? 0; - async function handleConfirmClick() { - createAndSendTariff(serviceKey).then(result => { - devlog(result); - enqueueSnackbar("Тариф создан"); - }).catch(error => { - const message = getMessageFromFetchError(error, "Не удалось создать тариф"); - if (message) enqueueSnackbar(message); - }); - } + async function handleConfirmClick() { + createAndSendTariff(serviceKey) + .then((result) => { + devlog(result); + enqueueSnackbar("Тариф создан"); + }) + .catch((error) => { + const message = getMessageFromFetchError( + error, + "Не удалось создать тариф" + ); + if (message) enqueueSnackbar(message); + }); + } - return ( - + + {privileges.map((privilege) => ( + + ))} + + {!upMd && ( + + )} + + - - {privileges.map(privilege => - - )} - - {!upMd && } - - - Чем больше пакеты, тем дешевле подписки и опции - - {"-60%"} - - - - Сумма с учетом скидки - - - {currencyFormatter.format(priceAfterDiscounts / 100)} - {currencyFormatter.format(priceBeforeDiscounts / 100)} - - - Выбрать - - + justifyContent: "space-between", + gap: "15%", + mb: "auto", + width: "100%", + }} + > + + Чем больше пакеты, тем дешевле подписки и опции{" "} + - ); + + Сумма с учетом скидки + + + + {currencyFormatter.format(priceAfterDiscounts / 100)} + + + {currencyFormatter.format(priceBeforeDiscounts / 100)} + + + + Выбрать + + + + ); } diff --git a/src/pages/TariffConstructor/TariffConstructor.tsx b/src/pages/TariffConstructor/TariffConstructor.tsx index 55e5c9f..517f78d 100644 --- a/src/pages/TariffConstructor/TariffConstructor.tsx +++ b/src/pages/TariffConstructor/TariffConstructor.tsx @@ -9,82 +9,96 @@ import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import TotalPrice from "@root/components/TotalPrice"; import { serviceNameByKey } from "@root/utils/serviceKeys"; - export default function TariffConstructor() { - const theme = useTheme(); - const upMd = useMediaQuery(theme.breakpoints.up("md")); - const customTariffs = useCustomTariffsStore(state => state.customTariffsMap); - const summaryPriceBeforeDiscountsMap = useCustomTariffsStore(state => state.summaryPriceBeforeDiscountsMap); - const summaryPriceAfterDiscountsMap = useCustomTariffsStore(state => state.summaryPriceAfterDiscountsMap); + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); + const customTariffs = useCustomTariffsStore( + (state) => state.customTariffsMap + ); + const summaryPriceBeforeDiscountsMap = useCustomTariffsStore( + (state) => state.summaryPriceBeforeDiscountsMap + ); + const summaryPriceAfterDiscountsMap = useCustomTariffsStore( + (state) => state.summaryPriceAfterDiscountsMap + ); - const basePrice = Object.values(summaryPriceBeforeDiscountsMap).reduce((a, e) => a + e, 0); - const discountedPrice = Object.values(summaryPriceAfterDiscountsMap).reduce((a, e) => a + e, 0); + const basePrice = Object.values(summaryPriceBeforeDiscountsMap).reduce( + (a, e) => a + e, + 0 + ); + const discountedPrice = Object.values(summaryPriceAfterDiscountsMap).reduce( + (a, e) => a + e, + 0 + ); - return ( - - {upMd && } - + {upMd && } + + {Object.entries(customTariffs).map( + ([serviceKey, privileges], index) => ( + + - {Object.entries(customTariffs).map(([serviceKey, privileges], index) => ( - - - {!upMd && index === 0 && ( - - - - )} - - - - - ))} - - {upMd && ( - + {!upMd && index === 0 && ( + - Ваши сохраненные тарифы - - )} - - - ); + > + + + )} + + + + + ) + )} + + + Ваши сохраненные тарифы + + + + ); } diff --git a/src/pages/TariffConstructor/TariffItem.tsx b/src/pages/TariffConstructor/TariffItem.tsx index 70e0998..548cd27 100644 --- a/src/pages/TariffConstructor/TariffItem.tsx +++ b/src/pages/TariffConstructor/TariffItem.tsx @@ -1,135 +1,169 @@ import { useThrottle } from "@frontend/kitui"; -import { Box, SliderProps, Typography, useMediaQuery, useTheme } from "@mui/material"; -import CustomSlider from "@root/components/CustomSlider"; +import { + Box, + SliderProps, + Typography, + useMediaQuery, + useTheme, +} from "@mui/material"; +import { CustomSlider } from "@root/components/CustomSlider"; import NumberInputWithUnitAdornment from "@root/components/NumberInputWithUnitAdornment"; import CalendarIcon from "@root/components/icons/CalendarIcon"; import PieChartIcon from "@root/components/icons/PieChartIcon"; import { Privilege, PrivilegeValueType } from "@root/model/privilege"; import { useCartStore } from "@root/stores/cart"; -import { setCustomTariffsUserValue, useCustomTariffsStore } from "@root/stores/customTariffs"; +import { + setCustomTariffsUserValue, + useCustomTariffsStore, +} from "@root/stores/customTariffs"; import { useDiscountStore } from "@root/stores/discounts"; import { useUserStore } from "@root/stores/user"; import { getDeclension } from "@root/utils/declension"; import { useEffect, useState } from "react"; - const sliderSettingsByType: Record> = { - "день": { - max: 365, - step: 1, - }, - "шаблон": { - max: 1000000, - step: 1000, - }, - "МБ": { - max: 1000000, - step: 1000, - }, + день: { max: 365 }, + шаблон: { max: 1000000 }, + МБ: { max: 1000000 }, }; interface Props { - privilege: Privilege; + privilege: Privilege; } export default function TariffPrivilegeSlider({ privilege }: Props) { - const theme = useTheme(); - const upMd = useMediaQuery(theme.breakpoints.up("md")); - const userValue = useCustomTariffsStore(state => state.userValuesMap[privilege.serviceKey]?.[privilege._id]) ?? 0; - const discounts = useDiscountStore(state => state.discounts); - const currentCartTotal = useCartStore(state => state.cart.priceAfterDiscounts); - const purchasesAmount = useUserStore(state => state.userAccount?.wallet.purchasesAmount) ?? 0; - const [value, setValue] = useState(userValue); - const throttledValue = useThrottle(value, 200); + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); + const userValue = + useCustomTariffsStore( + (state) => state.userValuesMap[privilege.serviceKey]?.[privilege._id] + ) ?? 0; + const discounts = useDiscountStore((state) => state.discounts); + const currentCartTotal = useCartStore( + (state) => state.cart.priceAfterDiscounts + ); + const purchasesAmount = + useUserStore((state) => state.userAccount?.wallet.purchasesAmount) ?? 0; + const [value, setValue] = useState(userValue); + const throttledValue = useThrottle(value, 200); - useEffect(function setStoreValue() { - setCustomTariffsUserValue( - privilege.serviceKey, - privilege._id, - throttledValue, - discounts, - currentCartTotal, - purchasesAmount - ); - }, [currentCartTotal, discounts, purchasesAmount, privilege._id, privilege.serviceKey, throttledValue]); + useEffect( + function setStoreValue() { + setCustomTariffsUserValue( + privilege.serviceKey, + privilege._id, + throttledValue, + discounts, + currentCartTotal, + purchasesAmount + ); + }, + [ + currentCartTotal, + discounts, + purchasesAmount, + privilege._id, + privilege.serviceKey, + throttledValue, + ] + ); - function handleSliderChange(event: Event, value: number | number[]) { - if (Array.isArray(value)) throw new Error("Slider uses multiple values instead of one"); + function handleSliderChange(value: number | number[]) { + if (Array.isArray(value)) + throw new Error("Slider uses multiple values instead of one"); - setValue(value); - } + setValue(value); + } - const quantityText = `${value} ${getDeclension(value, privilege.value)}`; + const quantityText = `${value} ${getDeclension(value, privilege.value)}`; - const quantityElement = ( - + + {quantityText} + + + + или + + setValue(value)} + /> + + + ); + + const icon = + privilege.type === "day" ? ( + + ) : ( + + ); + + return ( + + + {privilege.description} + + + - - {quantityText} - - - или - setValue(value)} - /> - + mb: "8px", + justifyContent: "space-between", + gap: "10px", + }} + > + + {icon} + {privilege.name} + + {upMd && quantityElement} - ); - - const icon = privilege.type === "day" - ? - : ; - - return ( - - - {privilege.description} - - - - - {icon} - {privilege.name} - - {upMd && quantityElement} - - - {!upMd && quantityElement} - - - ); + + {!upMd && quantityElement} + + + ); } diff --git a/src/pages/Tariffs/TariffCard.tsx b/src/pages/Tariffs/TariffCard.tsx index 51e2a00..f48dfe9 100644 --- a/src/pages/Tariffs/TariffCard.tsx +++ b/src/pages/Tariffs/TariffCard.tsx @@ -75,7 +75,7 @@ export default function TariffCard({ icon, headerText, text, sx, price, buttonPr sx={{ color: theme.palette.brightPurple.main, borderColor: theme.palette.brightPurple.main, - mt: "auto", + mt: "30px", ...buttonProps.sx, }} > diff --git a/src/pages/Tariffs/Tariffs.tsx b/src/pages/Tariffs/Tariffs.tsx index 237ffdf..298fa24 100644 --- a/src/pages/Tariffs/Tariffs.tsx +++ b/src/pages/Tariffs/Tariffs.tsx @@ -89,7 +89,7 @@ export default function Tariffs() { {upMd ? - + : } {/* state.tariffs); - const [selectedItem, setSelectedItem] = useState(0); - const discounts = useDiscountStore(state => state.discounts); - const customTariffs = useCustomTariffsStore(state => state.customTariffsMap); - const purchasesAmount = useUserStore(state => state.userAccount?.wallet.purchasesAmount) ?? 0; - const cart = useCartStore(state => state.cart); - const unit: string = String(location.pathname).slice(9); + const theme = useTheme(); + const upMd = useMediaQuery(theme.breakpoints.up("md")); + const isMobile = useMediaQuery(theme.breakpoints.down(600)); + const location = useLocation(); + const tariffs = useTariffStore((state) => state.tariffs); + const [selectedItem, setSelectedItem] = useState(0); + const discounts = useDiscountStore((state) => state.discounts); + const customTariffs = useCustomTariffsStore( + (state) => state.customTariffsMap + ); + const purchasesAmount = + useUserStore((state) => state.userAccount?.wallet.purchasesAmount) ?? 0; + const cart = useCartStore((state) => state.cart); + const unit: string = String(location.pathname).slice(9); const StepperText: Record = { volume: "Тарифы на объём", @@ -155,7 +158,7 @@ export default function TariffPage() { > {tariffElements} - + Ранее вы покупали diff --git a/src/pages/Tariffs/slider/slider.css b/src/pages/Tariffs/slider/slider.css index c31921f..9c53cf4 100644 --- a/src/pages/Tariffs/slider/slider.css +++ b/src/pages/Tariffs/slider/slider.css @@ -1,3 +1,7 @@ +.slider { + margin-top: 40px; +} + .slider .slick-slide { width: 100%; max-width: 360px; diff --git a/src/pages/Tariffs/slider/slider.tsx b/src/pages/Tariffs/slider/slider.tsx index 6a25840..bdf1d47 100644 --- a/src/pages/Tariffs/slider/slider.tsx +++ b/src/pages/Tariffs/slider/slider.tsx @@ -59,7 +59,7 @@ export const Slider = ({ items }: SliderProps) => { display: "grid", gap: "40px", gridTemplateColumns: "repeat(auto-fit, minmax(300px, 360px))", - margin: isTablet ? "auto" : null, + margin: isTablet ? "40px auto" : null, }} > {items}