File size: 1,301 Bytes
b24b684
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { Box, Card, CardContent, Stack, Typography } from "@mui/material";
import type { ReactNode } from "react";

interface Props {
  label: string;
  value: ReactNode;
  icon: ReactNode;
  color?: string;
  hint?: string;
}

export default function StatCard({ label, value, icon, color = "#4F46E5", hint }: Props) {
  return (
    <Card sx={{ height: "100%" }}>

      <CardContent>

        <Stack direction="row" justifyContent="space-between" alignItems="flex-start">

          <Box>

            <Typography variant="body2" color="text.secondary" fontWeight={600}>

              {label}

            </Typography>

            <Typography variant="h4" sx={{ mt: 1 }}>

              {value}

            </Typography>

            {hint && (

              <Typography variant="caption" color="text.secondary">

                {hint}

              </Typography>

            )}

          </Box>

          <Box

            sx={{

              width: 48,

              height: 48,

              borderRadius: 2.5,

              display: "grid",

              placeItems: "center",

              bgcolor: `${color}1A`,

              color,

            }}

          >

            {icon}

          </Box>

        </Stack>

      </CardContent>

    </Card>
  );
}