Skip to content

Commit db09e20

Browse files
author
soheil
committed
Apply suggestions from code review
1 parent 35189ea commit db09e20

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

src/components/Staking/StakingStatsBox.tsx

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
// Import libraries
22
import React, { useState, useEffect, ReactNode } from "react"
33
import { useIntl } from "react-intl"
4-
import { Code, Flex, Icon, Spinner } from "@chakra-ui/react"
4+
import {
5+
Code,
6+
Divider,
7+
Flex,
8+
Icon,
9+
Spinner,
10+
useBreakpointValue,
11+
VStack,
12+
} from "@chakra-ui/react"
513
// Import components
614
import Translation from "../Translation"
715
import Tooltip from "../Tooltip"
@@ -19,26 +27,21 @@ const MAX_EFFECTIVE_BALANCE = 32
1927

2028
const Cell: React.FC<{ children: ReactNode }> = ({ children }) => {
2129
return (
22-
<Flex
23-
direction="column"
24-
alignItems="center"
25-
py={4}
26-
px={8}
27-
borderLeft={{ base: "none", md: "1px solid" }}
28-
borderLeftColor={{ md: "preBorder" }}
29-
borderTop={{ base: "1px solid #33333355", md: "none" }}
30-
sx={{
31-
"&:first-child": {
32-
borderLeft: "none",
33-
borderTop: "none",
34-
},
35-
}}
36-
>
30+
<VStack spacing={2} py={4} px={8}>
3731
{children}
38-
</Flex>
32+
</VStack>
3933
)
4034
}
4135

36+
const CellDivider = () => {
37+
// Hook needed because the `orientation` prop does not directly accept responsive values
38+
const orientation = useBreakpointValue<"horizontal" | "vertical">({
39+
base: "horizontal",
40+
md: "vertical",
41+
})
42+
return <Divider borderColor="preBorder" orientation={orientation} />
43+
}
44+
4245
const Value: React.FC<{ children: ReactNode; title: string }> = ({
4346
children,
4447
title,
@@ -49,10 +52,6 @@ const Value: React.FC<{ children: ReactNode; title: string }> = ({
4952
fontWeight="bold"
5053
fontSize="2rem"
5154
background="none"
52-
display="flex"
53-
alignItems="center"
54-
textAlign="center"
55-
textTransform="uppercase"
5655
color="primary"
5756
>
5857
{children}
@@ -62,13 +61,7 @@ const Value: React.FC<{ children: ReactNode; title: string }> = ({
6261

6362
const Label: React.FC<{ children: ReactNode }> = ({ children }) => {
6463
return (
65-
<Flex
66-
wrap="nowrap"
67-
alignItems="center"
68-
textTransform="uppercase"
69-
fontSize="sm"
70-
mt={2}
71-
>
64+
<Flex alignItems="center" textTransform="uppercase" fontSize="sm">
7265
{children}
7366
</Flex>
7467
)
@@ -168,6 +161,7 @@ const StakingStatsBox: React.FC<IProps> = () => {
168161
<BeaconchainTooltip />
169162
</Label>
170163
</Cell>
164+
<CellDivider />
171165
<Cell>
172166
{totalValidators === ZERO ? (
173167
<Spinner />
@@ -181,6 +175,7 @@ const StakingStatsBox: React.FC<IProps> = () => {
181175
<BeaconchainTooltip />
182176
</Label>
183177
</Cell>
178+
<CellDivider />
184179
<Cell>
185180
{currentApr === ZERO ? (
186181
<Spinner />

0 commit comments

Comments
 (0)