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 {
3
+ Box ,
4
+ Flex ,
5
+ Heading ,
6
+ Icon ,
7
+ Text ,
8
+ useTheme ,
9
+ VStack ,
10
+ } from "@chakra-ui/react"
4
11
5
12
import Link from "../Link"
6
13
import Translation from "../Translation"
@@ -12,67 +19,13 @@ import SoloGlyph from "../../assets/staking/staking-glyph-cpu.svg"
12
19
import SaasGlyph from "../../assets/staking/staking-glyph-cloud.svg"
13
20
import PoolGlyph from "../../assets/staking/staking-glyph-token-wallet.svg"
14
21
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
22
interface DataType {
70
23
title : TranslationKey
71
24
linkText : TranslationKey
72
25
to : string
73
26
matomo : EventOptions
74
- color : any
75
- glyph : any
27
+ color : string
28
+ glyph : JSX . Element
76
29
}
77
30
78
31
type StakingTypePage = "solo" | "saas" | "pools"
@@ -96,7 +49,7 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
96
49
eventName : "clicked solo staking" ,
97
50
} ,
98
51
color : stakingGold ,
99
- glyph : < StyledSoloGlyph /> ,
52
+ glyph : < Icon as = { SoloGlyph } color = "stakingGold" boxSize = "50px" /> ,
100
53
}
101
54
const saas : DataType = {
102
55
title : "page-staking-saas-with-abbrev" ,
@@ -108,7 +61,7 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
108
61
eventName : "clicked staking as a service" ,
109
62
} ,
110
63
color : stakingGreen ,
111
- glyph : < StyledSaasGlyph /> ,
64
+ glyph : < Icon as = { SaasGlyph } color = "stakingGreen" boxSize = "50px" /> ,
112
65
}
113
66
const pools : DataType = {
114
67
title : "page-staking-dropdown-pools" ,
@@ -120,7 +73,7 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
120
73
eventName : "clicked pooled staking" ,
121
74
} ,
122
75
color : stakingBlue ,
123
- glyph : < StyledPoolGlyph /> ,
76
+ glyph : < Icon as = { PoolGlyph } color = "stakingBlue" boxSize = "50px" /> ,
124
77
}
125
78
const data : {
126
79
[ key in StakingTypePage ] : ( DataType & {
@@ -162,19 +115,36 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
162
115
const selectedData = data [ page ]
163
116
164
117
return (
165
- < GradientContainer className = { className } >
166
- < h2 > Comparison with other options</ h2 >
118
+ < Flex
119
+ direction = "column"
120
+ gap = { 8 }
121
+ bg = "linear-gradient(
122
+ 83.46deg,
123
+ rgba(127, 127, 213, 0.2) 7.03%,
124
+ rgba(138, 168, 231, 0.2) 52.42%,
125
+ rgba(145, 234, 228, 0.2) 98.77%
126
+ )"
127
+ py = { 8 }
128
+ px = { { base : 6 , md : 8 } }
129
+ mt = { 16 }
130
+ className = { className }
131
+ >
132
+ < Heading > Comparison with other options</ Heading >
167
133
{ selectedData . map (
168
134
( { title, linkText, to, color, content, glyph, matomo } , idx ) => (
169
- < Flex key = { idx } >
170
- { ! ! glyph && < Glyph > { glyph } </ Glyph > }
171
- < div >
172
- < h3 style = { { color } } >
135
+ < Flex gap = { 6 } direction = { { base : "column" , md : "row" } } key = { idx } >
136
+ { ! ! glyph && (
137
+ < VStack w = { 12 } maxH = { 12 } >
138
+ { glyph }
139
+ </ VStack >
140
+ ) }
141
+ < Box >
142
+ < Heading as = "h3" color = { color } mt = { 0 } mb = { 2 } >
173
143
< Translation id = { title } />
174
- </ h3 >
175
- < p >
144
+ </ Heading >
145
+ < Text >
176
146
< Translation id = { content } />
177
- </ p >
147
+ </ Text >
178
148
< Link
179
149
onClick = { ( ) => {
180
150
trackCustomEvent ( matomo )
@@ -183,11 +153,11 @@ const StakingComparison: React.FC<IProps> = ({ page, className }) => {
183
153
>
184
154
< Translation id = { linkText } />
185
155
</ Link >
186
- </ div >
156
+ </ Box >
187
157
</ Flex >
188
158
)
189
159
) }
190
- </ GradientContainer >
160
+ </ Flex >
191
161
)
192
162
}
193
163
0 commit comments