1
1
// Import libraries
2
- import React , { useState , useEffect } from "react"
3
- import styled from "@emotion/styled "
2
+ import React , { useState , useEffect , ReactNode } from "react"
3
+ import { MdInfoOutline } from "react-icons/md "
4
4
import { useIntl } from "react-intl"
5
- import { Spinner } from "@chakra-ui/react"
5
+ import { Code , Flex , Icon , Spinner , VStack } from "@chakra-ui/react"
6
6
// Import components
7
7
import Translation from "../Translation"
8
8
import Tooltip from "../Tooltip"
9
9
import Link from "../Link"
10
- import Icon from "../Icon"
11
10
// Import utilities
12
11
import { Lang } from "../../utils/languages"
13
12
import { getData } from "../../utils/cache"
@@ -18,61 +17,51 @@ const NA_ERROR = "n/a"
18
17
const ZERO = "0"
19
18
const MAX_EFFECTIVE_BALANCE = 32
20
19
21
- // Styled components
22
- const Container = styled . div `
23
- display: flex;
24
- @media (max-width: ${ ( { theme } ) => theme . breakpoints . m } ) {
25
- flex-direction: column;
26
- }
27
- `
28
-
29
- const Cell = styled . div `
30
- display: flex;
31
- flex-direction: column;
32
- align-items: center;
33
- padding: 1rem 2rem;
34
- border-left: 1px solid ${ ( { theme } ) => theme . colors . preBorder } ;
35
- @media (max-width: ${ ( { theme } ) => theme . breakpoints . m } ) {
36
- border-left: none;
37
- border-top: 1px solid #33333355;
38
- }
39
- &:first-child {
40
- border-left: none;
41
- border-top: none;
42
- }
43
- `
44
-
45
- const Value = styled . code `
46
- font-weight: 700;
47
- font-size: 2rem;
48
- background: none;
49
- display: flex;
50
- align-items: center;
51
- text-align: center;
52
- text-transform: uppercase;
53
- color: ${ ( { theme } ) => theme . colors . primary } ;
54
- `
20
+ const Cell : React . FC < { children : ReactNode } > = ( { children } ) => {
21
+ return (
22
+ < VStack
23
+ spacing = { 2 }
24
+ py = { 4 }
25
+ px = { 8 }
26
+ borderLeft = { { md : "1px" } }
27
+ borderTop = { { base : "1px" , md : "none" } }
28
+ // `!important` needed to force an override of the user-agent
29
+ borderColor = "preBorder !important"
30
+ _first = { {
31
+ borderLeft : "none" ,
32
+ borderTop : "none" ,
33
+ } }
34
+ >
35
+ { children }
36
+ </ VStack >
37
+ )
38
+ }
55
39
56
- const Label = styled . div `
57
- display: flex;
58
- flex-wrap: nowrap;
59
- align-items: center;
60
- text-transform: uppercase;
61
- font-size: 0.875rem;
62
- margin-top: 0.5rem;
63
- `
40
+ const Value : React . FC < { children : ReactNode ; title : string } > = ( {
41
+ children,
42
+ title,
43
+ } ) => {
44
+ return (
45
+ < Code
46
+ title = { title }
47
+ fontWeight = "bold"
48
+ fontSize = "2rem"
49
+ background = "none"
50
+ color = "primary"
51
+ p = { 0 }
52
+ >
53
+ { children }
54
+ </ Code >
55
+ )
56
+ }
64
57
65
- const StyledIcon = styled ( Icon ) `
66
- fill: ${ ( { theme } ) => theme . colors . text } ;
67
- margin-inline-start: 0.5rem;
68
- @media (max-width: ${ ( { theme } ) => theme . breakpoints . l } ) {
69
- }
70
- &:hover,
71
- &:active,
72
- &:focus {
73
- fill: ${ ( { theme } ) => theme . colors . primary } ;
74
- }
75
- `
58
+ const Label : React . FC < { children : ReactNode } > = ( { children } ) => {
59
+ return (
60
+ < Flex alignItems = "center" textTransform = "uppercase" fontSize = "sm" >
61
+ { children }
62
+ </ Flex >
63
+ )
64
+ }
76
65
77
66
// BeaconchainTooltip component
78
67
const BeaconchainTooltip = ( { isEthStore } : { isEthStore ?: boolean } ) => (
@@ -87,7 +76,15 @@ const BeaconchainTooltip = ({ isEthStore }: { isEthStore?: boolean }) => (
87
76
</ div >
88
77
}
89
78
>
90
- < StyledIcon name = "info" size = "16" />
79
+ < Icon
80
+ as = { MdInfoOutline }
81
+ color = "text"
82
+ marginInlineStart = { 2 }
83
+ _hover = { { color : "primary" } }
84
+ _active = { { color : "primary" } }
85
+ _focus = { { color : "primary" } }
86
+ boxSize = { 4 }
87
+ />
91
88
</ Tooltip >
92
89
)
93
90
@@ -148,7 +145,7 @@ const StakingStatsBox: React.FC<IProps> = () => {
148
145
} , [ intl . locale ] )
149
146
150
147
return (
151
- < Container >
148
+ < Flex direction = { { base : "column" , md : "row" } } >
152
149
< Cell >
153
150
{ totalEth === ZERO ? (
154
151
< Spinner />
@@ -186,7 +183,7 @@ const StakingStatsBox: React.FC<IProps> = () => {
186
183
< BeaconchainTooltip isEthStore />
187
184
</ Label >
188
185
</ Cell >
189
- </ Container >
186
+ </ Flex >
190
187
)
191
188
}
192
189
0 commit comments