-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathStatistic.tsx
More file actions
41 lines (37 loc) · 1.15 KB
/
Statistic.tsx
File metadata and controls
41 lines (37 loc) · 1.15 KB
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
import { Skeleton, Stack, Typography } from "@mui/material"
import NumberTypography from "@/components/NumberTypography"
const Statistic = props => {
const { label, children, loading, sx } = props
return (
<Stack
direction="column"
sx={{
flex: [1, "0 0 auto"],
width: ["auto", "18rem"],
maxWidth: "50%",
borderRadius: ["0.8rem", "1.6rem"],
p: ["0.8rem", "0.8rem 1.6rem"],
backgroundColor: "themeBackground.light",
...sx,
}}
>
<Typography
sx={{
fontSize: ["1.4rem", "1.6rem"],
lineHeight: ["2rem", "2.4rem"],
fontWeight: 600,
textAlign: "center",
whiteSpace: ["pre-wrap", "pre-wrap", "nowrap"],
}}
>
{label}
</Typography>
<NumberTypography
sx={{ fontSize: ["1.8rem", "2.4rem"], lineHeight: ["2.8rem", "3.2rem"], fontWeight: 600, textAlign: "center", whiteSpace: "nowrap" }}
>
{loading ? <Skeleton sx={{ borderRadius: "1rem", width: "50%", display: "inline-block" }}></Skeleton> : <>{children}</>}
</NumberTypography>
</Stack>
)
}
export default Statistic