1 | import React from "react";
|
2 | import styled from "styled-components";
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export default function SumCard({
|
14 | label,
|
15 | value,
|
16 | children,
|
17 | rounded = true,
|
18 | color = "#118adb",
|
19 | style,
|
20 | }) {
|
21 | const boxStyle = { borderColor: color, borderRadius: "4px", ...style };
|
22 | if (rounded) {
|
23 | boxStyle.borderRadius = "46px";
|
24 | }
|
25 |
|
26 | return (
|
27 | <SBox style={boxStyle}>
|
28 | <SIcon
|
29 | style={{
|
30 | background: color,
|
31 | borderRadius: rounded ? "50%" : "2px",
|
32 | }}
|
33 | >
|
34 | {children}
|
35 | </SIcon>
|
36 | <STitle>{label}</STitle>
|
37 | <div style={{ flex: 1 }}></div>
|
38 | <SValue>{value}</SValue>
|
39 | </SBox>
|
40 | );
|
41 | }
|
42 |
|
43 | const SBox = styled.div`
|
44 | display: flex;
|
45 | align-items: center;
|
46 | margin-bottom: 20px;
|
47 | border: 1px solid;
|
48 | padding: 10px;
|
49 | background: white;
|
50 | `;
|
51 |
|
52 | const SIcon = styled.div`
|
53 | flex-shrink: 0;
|
54 | width: 50px;
|
55 | height: 50px;
|
56 | display: flex;
|
57 | align-items: center;
|
58 | justify-content: center;
|
59 | margin-right: 10px;
|
60 | `;
|
61 |
|
62 | const STitle = styled.div`
|
63 | color: gray;
|
64 | letter-spacing: 1px;
|
65 | font-size: 14px;
|
66 | margin-right: 5px;
|
67 | `;
|
68 |
|
69 | const SValue = styled.div`
|
70 | font-size: 30px;
|
71 | `;
|