1
- import React , { useContext } from "react"
2
- import styled from "@emotion/styled"
3
- import { useTheme } from "@emotion/react"
1
+ import React from "react"
2
+ import { Box , Flex , Heading , Icon , Text , useTheme } from "@chakra-ui/react"
4
3
5
4
import Link from "../Link"
6
5
import Translation from "../Translation"
@@ -12,67 +11,13 @@ import SoloGlyph from "../../assets/staking/staking-glyph-cpu.svg"
12
11
import SaasGlyph from "../../assets/staking/staking-glyph-cloud.svg"
13
12
import PoolGlyph from "../../assets/staking/staking-glyph-token-wallet.svg"
14
13
15
- const GradientContainer = styled . div `
16
- display: flex;
17
- flex-direction: column;
18
- gap: 2rem;
19
- background: linear-gradient(
20
- 83.46deg,
21
- rgba(127, 127, 213, 0.2) 7.03%,
22
- rgba(138, 168, 231, 0.2) 52.42%,
23
- rgba(145, 234, 228, 0.2) 98.77%
24
- );
25
- padding: 2rem;
26
- margin-top: 4rem;
27
- @media (max-width: ${ ( { theme } ) => theme . breakpoints . m } ) {
28
- padding: 2rem 1.5rem;
29
- }
30
-
31
- h3 {
32
- margin: 0 0 0.5rem;
33
- }
34
- `
35
-
36
- const Flex = styled . div `
37
- display: flex;
38
- gap: 1.5rem;
39
- @media (max-width: ${ ( { theme } ) => theme . breakpoints . m } ) {
40
- flex-direction: column;
41
- }
42
- `
43
-
44
- const Glyph = styled . div `
45
- display: flex;
46
- flex-direction: column;
47
- justify-content: flex-start;
48
- align-items: center;
49
- width: 3rem;
50
- max-height: 3rem;
51
- `
52
-
53
- const StyledSoloGlyph = styled ( SoloGlyph ) `
54
- path {
55
- fill: ${ ( { theme } ) => theme . colors . stakingGold } ;
56
- }
57
- `
58
- const StyledSaasGlyph = styled ( SaasGlyph ) `
59
- path {
60
- fill: ${ ( { theme } ) => theme . colors . stakingGreen } ;
61
- }
62
- `
63
- const StyledPoolGlyph = styled ( PoolGlyph ) `
64
- path {
65
- fill: ${ ( { theme } ) => theme . colors . stakingBlue } ;
66
- }
67
- `
68
-
69
14
interface DataType {
70
15
title : TranslationKey
71
16
linkText : TranslationKey
72
17
to : string
73
18
matomo : EventOptions
74
- color : any
75
- glyph : any
19
+ color : string
20
+ glyph : JSX . Element
76
21
}
77
22
78
23
type StakingTypePage = "solo" | "saas" | "pools"
@@ -96,7 +41,7 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
96
41
eventName : "clicked solo staking" ,
97
42
} ,
98
43
color : stakingGold ,
99
- glyph : < StyledSoloGlyph /> ,
44
+ glyph : < Icon as = { SoloGlyph } color = "stakingGold" boxSize = "50px" /> ,
100
45
}
101
46
const saas : DataType = {
102
47
title : "page-staking-saas-with-abbrev" ,
@@ -108,7 +53,7 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
108
53
eventName : "clicked staking as a service" ,
109
54
} ,
110
55
color : stakingGreen ,
111
- glyph : < StyledSaasGlyph /> ,
56
+ glyph : < Icon as = { SaasGlyph } color = "stakingGreen" w = "50px" h = "28px" /> ,
112
57
}
113
58
const pools : DataType = {
114
59
title : "page-staking-dropdown-pools" ,
@@ -120,7 +65,7 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
120
65
eventName : "clicked pooled staking" ,
121
66
} ,
122
67
color : stakingBlue ,
123
- glyph : < StyledPoolGlyph /> ,
68
+ glyph : < Icon as = { PoolGlyph } color = "stakingBlue" w = "50px" h = "39px" /> ,
124
69
}
125
70
const data : {
126
71
[ key in StakingTypePage ] : ( DataType & {
@@ -162,19 +107,42 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
162
107
const selectedData = data [ page ]
163
108
164
109
return (
165
- < GradientContainer className = { className } >
166
- < h2 > Comparison with other options</ h2 >
110
+ < Flex
111
+ direction = "column"
112
+ gap = { 8 }
113
+ bg = "linear-gradient(
114
+ 83.46deg,
115
+ rgba(127, 127, 213, 0.2) 7.03%,
116
+ rgba(138, 168, 231, 0.2) 52.42%,
117
+ rgba(145, 234, 228, 0.2) 98.77%
118
+ )"
119
+ py = { 8 }
120
+ px = { { base : 6 , md : 8 } }
121
+ mt = { 16 }
122
+ className = { className }
123
+ >
124
+ < Heading fontSize = "2rem" > Comparison with other options</ Heading >
167
125
{ selectedData . map (
168
126
( { title, linkText, to, color, content, glyph, matomo } , idx ) => (
169
- < Flex key = { idx } >
170
- { ! ! glyph && < Glyph > { glyph } </ Glyph > }
171
- < div >
172
- < h3 style = { { color } } >
127
+ < Flex gap = { 6 } direction = { { base : "column" , md : "row" } } key = { idx } >
128
+ { ! ! glyph && (
129
+ < Flex
130
+ direction = "column"
131
+ justify = "flex-start"
132
+ align = "center"
133
+ w = { 12 }
134
+ maxH = { 12 }
135
+ >
136
+ { glyph }
137
+ </ Flex >
138
+ ) }
139
+ < Box >
140
+ < Heading as = "h3" fontSize = "2xl" color = { color } mt = { 0 } mb = { 2 } >
173
141
< Translation id = { title } />
174
- </ h3 >
175
- < p >
142
+ </ Heading >
143
+ < Text >
176
144
< Translation id = { content } />
177
- </ p >
145
+ </ Text >
178
146
< Link
179
147
onClick = { ( ) => {
180
148
trackCustomEvent ( matomo )
@@ -183,11 +151,11 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
183
151
>
184
152
< Translation id = { linkText } />
185
153
</ Link >
186
- </ div >
154
+ </ Box >
187
155
</ Flex >
188
156
)
189
157
) }
190
- </ GradientContainer >
158
+ </ Flex >
191
159
)
192
160
}
193
161
0 commit comments