fix SaveWrapper
This commit is contained in:
parent
6bf466f3bd
commit
5414b57a09
@ -1,10 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Box, Typography,
|
||||
IconButton,
|
||||
useMediaQuery,
|
||||
useTheme
|
||||
} from "@mui/material";
|
||||
import { Box, Typography, IconButton, useMediaQuery, useTheme } from "@mui/material";
|
||||
import ExpandIcon from "@components/icons/ExpandIcon";
|
||||
import { currencyFormatter } from "@root/utils/currencyFormatter";
|
||||
import { removeTariffFromCart } from "@root/stores/user";
|
||||
@ -12,7 +7,6 @@ import { enqueueSnackbar } from "notistack";
|
||||
import { TariffCartData, getMessageFromFetchError } from "@frontend/kitui";
|
||||
import { ReactComponent as CrossIcon } from "@root/assets/Icons/cross.svg";
|
||||
|
||||
|
||||
interface Props {
|
||||
tariffCartData: TariffCartData;
|
||||
}
|
||||
@ -103,14 +97,12 @@ export default function CustomTariffAccordion({ tariffCartData }: Props) {
|
||||
{currencyFormatter.format(tariffCartData.price / 100)}
|
||||
</Typography>
|
||||
</Box>
|
||||
<IconButton
|
||||
onClick={handleDeleteClick}
|
||||
sx={{ padding: 0, height: "22px", width: "22px" }}
|
||||
>
|
||||
<IconButton onClick={handleDeleteClick} sx={{ padding: 0, height: "22px", width: "22px" }}>
|
||||
<CrossIcon style={{ height: "22 px", width: "22px" }} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
{isExpanded && tariffCartData.privileges.map((privilege) => (
|
||||
{isExpanded &&
|
||||
tariffCartData.privileges.map((privilege) => (
|
||||
<Box
|
||||
key={privilege.privilegeId}
|
||||
sx={{
|
||||
|
@ -13,10 +13,10 @@ import { PrivilegeCartData, getMessageFromFetchError } from "@frontend/kitui";
|
||||
|
||||
interface Props {
|
||||
content: PrivilegeCartData[];
|
||||
serviceKey: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
const SaveWrapper: FC<Props> = ({ content, serviceKey }) => {
|
||||
const SaveWrapper: FC<Props> = ({ content, name }) => {
|
||||
const theme = useTheme();
|
||||
const upMd = useMediaQuery(theme.breakpoints.up("md"));
|
||||
const upSm = useMediaQuery(theme.breakpoints.up("sm"));
|
||||
@ -46,7 +46,7 @@ const SaveWrapper: FC<Props> = ({ content, serviceKey }) => {
|
||||
boxShadow: cardShadow,
|
||||
}}
|
||||
>
|
||||
{content.map(({ tariffName, price, description, tariffId }, index) => (
|
||||
{content.map(({ price, description, privilegeId }, index) => (
|
||||
<CustomAccordion
|
||||
key={index}
|
||||
divide
|
||||
@ -75,7 +75,7 @@ const SaveWrapper: FC<Props> = ({ content, serviceKey }) => {
|
||||
color: "#7E2AEA",
|
||||
}}
|
||||
>
|
||||
{extractDateFromString(tariffName)}
|
||||
{extractDateFromString(name)}
|
||||
</Typography>
|
||||
<Typography
|
||||
sx={{
|
||||
@ -104,7 +104,7 @@ const SaveWrapper: FC<Props> = ({ content, serviceKey }) => {
|
||||
{new Intl.NumberFormat("ru-RU").format(price)} руб.
|
||||
</Typography>
|
||||
<CustomButton
|
||||
onClick={() => handleTariffItemClick(tariffId)}
|
||||
onClick={() => handleTariffItemClick(privilegeId)}
|
||||
variant="contained"
|
||||
sx={{
|
||||
mr: "25px",
|
||||
|
@ -41,7 +41,7 @@ export default function Faq() {
|
||||
<Box mt={upMd ? "27px" : "10px"}>
|
||||
{cart.services.map(({ serviceKey, tariffs }) =>
|
||||
serviceKey === "custom"
|
||||
? tariffs.map(({ privileges }) => <SaveWrapper serviceKey={serviceKey} content={privileges} />)
|
||||
? tariffs.map(({ privileges, name }) => <SaveWrapper name={name} content={privileges} />)
|
||||
: null
|
||||
)}
|
||||
</Box>
|
||||
|
Loading…
Reference in New Issue
Block a user