Skip to content

Commit 5f21602

Browse files
committed
chore: convert grid element
1 parent 3ed3fd2 commit 5f21602

File tree

1 file changed

+41
-30
lines changed

1 file changed

+41
-30
lines changed

src/components/StatsBoxGrid.tsx

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import axios from "axios"
55
import { kebabCase } from "lodash"
66
import { AreaChart, ResponsiveContainer, Area, XAxis } from "recharts"
77

8+
import { Grid, Icon } from "@chakra-ui/react"
9+
import { MdInfoOutline } from "react-icons/md"
10+
811
import Translation from "./Translation"
912
import Tooltip from "./Tooltip"
1013
import Link from "./Link"
11-
import Icon from "./Icon"
14+
// import Icon from "./Icon"
1215
import StatErrorMessage from "./StatErrorMessage"
1316
import StatLoadingMessage from "./StatLoadingMessage"
1417

@@ -46,22 +49,6 @@ const Title = styled.p`
4649
font-family: ${(props) => props.theme.fonts.monospace};
4750
`
4851

49-
const Grid = styled.div`
50-
display: grid;
51-
grid-template-columns: repeat(2, 1fr);
52-
margin: 2rem 2rem 0;
53-
border-radius: 2px;
54-
@media (max-width: ${({ theme }) => theme.breakpoints.l}) {
55-
display: flex;
56-
flex-direction: column;
57-
width: 100%;
58-
margin: 2rem 0 0;
59-
}
60-
@media (max-width: ${({ theme }) => theme.breakpoints.s}) {
61-
margin: 0;
62-
}
63-
`
64-
6552
const Box = styled.div`
6653
position: relative;
6754
color: ${({ theme }) => theme.colors.text};
@@ -87,17 +74,17 @@ const StatRow = styled.div`
8774
flex-direction: column;
8875
`
8976

90-
const StyledIcon = styled(Icon)`
91-
fill: ${({ theme }) => theme.colors.text};
92-
margin-right: 0.5rem;
93-
@media (max-width: ${({ theme }) => theme.breakpoints.l}) {
94-
}
95-
&:hover,
96-
&:active,
97-
&:focus {
98-
fill: ${({ theme }) => theme.colors.primary};
99-
}
100-
`
77+
// const StyledIcon = styled(Icon)`
78+
// fill: ${({ theme }) => theme.colors.text};
79+
// margin-right: 0.5rem;
80+
// @media (max-width: ${({ theme }) => theme.breakpoints.l}) {
81+
// }
82+
// &:hover,
83+
// &:active,
84+
// &:focus {
85+
// fill: ${({ theme }) => theme.colors.primary};
86+
// }
87+
// `
10188

10289
const Lines = styled.div`
10390
position: absolute;
@@ -170,11 +157,19 @@ const GridItem: React.FC<IGridItemProps> = ({ metric, dir }) => {
170157
) : isLoading ? (
171158
<StatLoadingMessage />
172159
) : (
160+
// @TODO: Convert StatRow to Chakra
173161
<StatRow>
174162
<span>
175163
{state.value}{" "}
176164
<Tooltip content={tooltipContent(metric)}>
177-
<StyledIcon name="info" />
165+
{/* @TODO: continue migrate Icon
166+
167+
https://github.com/chakra-ui/chakra-ui/issues/363
168+
*/}
169+
<Icon
170+
as={MdInfoOutline}
171+
sx={{ "svg:hover": { fill: "text" } }}
172+
></Icon>
178173
</Tooltip>
179174
</span>
180175
</StatRow>
@@ -563,7 +558,23 @@ const StatsBoxGrid: React.FC<IProps> = () => {
563558
]
564559
const dir = isLangRightToLeft(intl.locale as Lang) ? "rtl" : "ltr"
565560
return (
566-
<Grid>
561+
<Grid
562+
display={{
563+
base: "flex",
564+
lg: "grid",
565+
}}
566+
gridTemplateColumns="repeat(2, 1fr)"
567+
margin={{
568+
base: "0",
569+
md: "2rem 0 0",
570+
lg: "2rem 2rem 0",
571+
}}
572+
borderRadius="2px"
573+
flexDirection={{
574+
base: "column",
575+
lg: "column",
576+
}}
577+
>
567578
{metrics.map((metric, idx) => (
568579
<GridItem key={idx} metric={metric} dir={dir} />
569580
))}

0 commit comments

Comments
 (0)