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 | 2x 2x 2x 2x 2x 2x | import * as React from "react";
// import { palette } from "@palette";
import { RevenuesData } from "./data";
// @mui
import { Box, styled } from "@mui/material";
// components
import { KeyVal } from "@common/KeyVal";
// import { Text } from "@common/Text";
// assets
// utils
import { toEnFormat } from "@utils/index";
const dummyInfo = {
source: "New Donation Form",
sourceDescription: "Website",
fundraiser: "New Donation Form",
revenueSource: "Givebox Public API",
transaction: 7,
url: "buddyteal.com/",
date: "Jun 30 2022 10:23PM UCT",
amount: 280,
average: 40,
VisitorsViews: 51,
Visitors: 14,
};
type ExpandedRowProps = {
rowData: RevenuesData;
type: string;
VisitorsViews: boolean;
Visitors: boolean;
};
export const ExpandedRow: React.FC<ExpandedRowProps> = ({
rowData,
type,
VisitorsViews = false,
Visitors = false,
}) => {
const data =
rowData && rowData.details !== undefined ? rowData.details : dummyInfo;
return (
<>
<StyledBox>
<Box sx={{ display: "flex", p: "16px" }}>
<Compart>
<Box>
<KeyVal
keyName={type}
value={
type === "Membership" ? "General Membership" : data.fundraiser
}
/>
</Box>
<Box>
<KeyVal keyName={"Revenue Source "} value={data.revenueSource} />
</Box>
<Box>
<KeyVal
isAmount={true}
keyName={"Amount"}
value={toEnFormat(data.amount)}
/>
</Box>
<Box>
<KeyVal keyName={"Transaction"} value={data.transaction} />
</Box>
<Box>
{VisitorsViews && (
<KeyVal keyName={"Visitor Views:"} value={data.VisitorsViews} />
)}
</Box>
</Compart>
<Compart>
<Contents>
<Box>
<KeyVal keyName={"Date"} value={data.date} />
</Box>
<SpacedFlex>
<Box>
<KeyVal keyName={" URL"} value={data.url} />
</Box>
</SpacedFlex>
<Box>
<KeyVal
isAmount={true}
keyName={" Average Transaction"}
value={toEnFormat(data.average)}
/>
</Box>
<Box>
{Visitors && (
<KeyVal keyName={"Visitors"} value={data.Visitors} />
)}
</Box>
</Contents>
</Compart>
</Box>
</StyledBox>
</>
);
};
const StyledBox = styled(Box)({
display: "flex",
gap: "12px",
flexDirection: "column",
padding: "24px 12px 16px 12px",
});
const Compart = styled(Box)({
flex: 1,
display: "flex",
flexDirection: "column",
gap: "12px",
});
const Contents = styled(Box)({
display: "flex",
flexDirection: "column",
gap: "16px",
"& >.MuiBox-root": {
padding: "0 8px",
},
});
const SpacedFlex = styled(Box)({
display: "flex",
width: "100%",
justifyContent: "space-between",
alignItems: "center",
"& .MuiBox-root": {
flex: 1,
},
});
|