Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | 3x 14x 14x 1x 1x 3x 3x | import * as React from "react";
import { Collapse, Divider } from "@mui/material";
import { palette } from "@palette";
// mui
import Box from "@mui/material/Box";
import Menu from "@mui/material/Menu";
import { styled } from "@mui/material/styles";
import MuiAccordion, { AccordionProps } from "@mui/material/Accordion";
import MuiAccordionSummary, {
AccordionSummaryProps,
} from "@mui/material/AccordionSummary";
import MuiAccordionDetails from "@mui/material/AccordionDetails";
// components
import { Text } from "@common/Text";
import { DropdownItem } from "@common/Select";
import { IconButton } from "@common/IconButton";
import {
MakeRecurring,
ModifyRecurring,
Refund,
SendReceipt,
} from "@components/ManageMoney/TransactionTable/TableActions";
// assets
import { ArrowDropdownIcon, MoreIcon } from "@assets/icons";
import MobileTransactionExtraPurchaseInfo from "./MobileTransactionExtraPurchaseInfo";
import MobileTransactionAmountsCard from "./MobileTransactionAmountsCard";
import { Button } from "@common/Button";
type PurchaseProps = {
description: string;
title: string;
type: string;
recurrence: string;
donationAmount: number;
actionsHandler: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>, recurrence: string) => void;
};
const MobileTransactionPurchaseCard = ({
description,
title,
type,
recurrence,
donationAmount,
actionsHandler
}: PurchaseProps) => {
const [openRow, setOpenRow] = React.useState(false);
return (
<div>
<Collapse in={!openRow}>
<Box sx={StyledCard}>
<Box display="flex" justifyContent="space-between">
<Box onClick={() => setOpenRow(prevState => !prevState)}>
<Text variant="body" color={palette.neutral[600]}>
{description}
</Text>
<Text
variant="headline"
color={palette.neutral[800]}
fontWeight="medium"
pb="4px"
>
{title}
</Text>
</Box>
</Box>
<Box
sx={{
width: "100%",
display: "flex",
justifyContent: "space-between",
}}
onClick={() => setOpenRow(prevState => !prevState)}
>
<Box>
<Text
variant="headline"
color={palette.neutral[800]}
fontWeight="medium"
>
{type}
</Text>
<Text
variant="body"
textTransform="capitalize"
color={palette.neutral[600]}
>
{recurrence}
</Text>
</Box>
<Text
variant="body"
color={palette.neutral[800]}
fontWeight="medium"
>
{donationAmount}{" "}
<Box component="sup" fontSize="9px" lineHeight="9px">
USD
</Box>
</Text>
</Box>
</Box>
</Collapse>
<Collapse in={openRow}>
<Box sx={StyledCard}>
<Box display="flex" justifyContent="space-between">
<Box onClick={() => setOpenRow(prevState => !prevState)}>
<Text variant="body" color={palette.neutral[600]}>
{description}
</Text>
<Text
variant="headline"
color={palette.neutral[800]}
fontWeight="medium"
pb="4px"
>
{title}
</Text>
</Box>
</Box>
<Divider sx={dividerStyle} />
<Button
variant="primary"
endIcon={<MoreIcon />}
fullWidth
sx={{ mb: "16px" }}
onClick={(e) => actionsHandler(e, recurrence)}
>
Actions
</Button>
<MobileTransactionExtraPurchaseInfo
Type="Charitable donation"
Recurrence={recurrence}
/>
<MobileTransactionAmountsCard amount />
<Text
fontSize={12}
textAlign="center"
color={palette.neutral[600]}
mb={"10px"}
>
*Visa fee deducted from donation
</Text>
</Box>
</Collapse>
</div>
);
};
const StyledCard = {
width: "100%",
display: "flex",
flexDirection: "column",
background: "#FFFFFF",
border: "2px solid #EADDFD",
boxShadow:
"0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03)",
borderRadius: "8px",
padding: "12px 8px",
};
const dividerStyle = {
my: "12px",
width: "calc(100% + 16px)",
transform: "translateX(-8px)",
};
export default MobileTransactionPurchaseCard;
|