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 | // import * as React from "react";
// import { palette } from "@palette";
// mui
import Box from "@mui/material/Box";
import Grid from "@mui/material/Grid";
import { useTheme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery";
// components
import { Text } from "@common/Text";
import ViewTransactionBannerMobile from "./ViewTransactionBannerMobile";
// localization
import { useTranslation } from "react-i18next";
import { namespaces } from "localization/resources/i18n.constants";
// utils
import { parseAmount, toEnFormat } from "@utils/index";
const backgroundGradient = {
position: "absolute",
background:
"linear-gradient(104.33deg, rgba(129, 68, 154, 0) 25.61%, #81449A 54.5%, #E6B96F 82.41%)",
borderRadius: "12px",
top: "10px",
height: "calc( 100% - 20px )",
width: "calc(100% + 6px)",
};
const mainContent = {
gap: "16px",
display: "flex",
padding: "16px 24px",
flexDirection: "column",
backgroundColor: "rgba(246, 250, 255, 0.8)",
boxShadow: "0px 4px 16px rgba(0, 0, 0, 0.05)",
border: "2px solid rgba(255, 255, 255, 0.5)",
backdropFilter: "blur( 32px )",
position: "relative",
borderRadius: "12px",
width: "100%",
"& .MuiTypography-root > sup": {
fontSize: "14px",
lineHeight: "14px",
},
};
const data = [
{
amount: 13527,
type: "Processed",
isCurrency: true,
isPercentage: false,
},
{
amount: 13527,
type: "Approved Total",
isCurrency: true,
isPercentage: false,
},
{
amount: 0,
type: "Refund Total",
isCurrency: true,
isPercentage: false,
},
{
amount: 0,
type: "Chargeback Total",
isCurrency: true,
isPercentage: false,
},
{
amount: 7,
type: "Transactions",
isCurrency: false,
isPercentage: false,
},
{
amount: 0,
type: "Approved",
isCurrency: false,
isPercentage: true,
},
{
amount: 0,
type: "Refunds",
isCurrency: false,
isPercentage: true,
},
{
amount: 0,
type: "Chargebacks",
isCurrency: false,
isPercentage: true,
},
];
const ViewTransactionBanner = () => {
const theme = useTheme();
const { t } = useTranslation(namespaces.pages.manageMoney);
const isDesktop = useMediaQuery(theme.breakpoints.up("sm"));
if (isDesktop) {
return (
<Box position="relative">
{/* Background gradient */}
<Box sx={backgroundGradient} />
<Box sx={mainContent}>
<Box display="flex" justifyContent="space-between">
<Grid container spacing={2}>
{data.map((item, index) => (
<Grid item xs={6} sm={3} key={index}>
<Box display="flex" flexDirection="column" width="207px">
{item.isCurrency && (
<Text
variant="h4"
fontWeight="medium"
color={theme.palette.info.main}
>
{parseAmount(item.amount)}
</Text>
)}
{!item.isCurrency && !item.isPercentage && (
<Text
variant="h4"
fontWeight="medium"
color={theme.palette.info.main}
>
{item.amount}
</Text>
)}
{!item.isCurrency && item.isPercentage && (
<Text
variant="h4"
fontWeight="medium"
color={theme.palette.info.main}
>
{parseAmount(item.amount)}
</Text>
)}
<Text
variant="caption"
fontWeight="medium"
color={theme.palette.neutral[600]}
>
{item.type}
</Text>
</Box>
</Grid>
))}
</Grid>
</Box>
</Box>
</Box>
);
}
return <ViewTransactionBannerMobile />;
};
export default ViewTransactionBanner;
|