Skip to content

Commit 3d07c44

Browse files
refactor(StakingLaunchpadWidget): migrate component to Chakra
1 parent 47221c6 commit 3d07c44

File tree

1 file changed

+54
-73
lines changed

1 file changed

+54
-73
lines changed

src/components/Staking/StakingLaunchpadWidget.tsx

Lines changed: 54 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState } from "react"
2-
import styled from "@emotion/styled"
32
import { useTranslation } from "gatsby-plugin-react-i18next"
3+
import { Box, chakra, Flex, Text } from "@chakra-ui/react"
44

55
import { StyledSelect as Select } from "../SharedStyledComponents"
66
import ButtonLink from "../ButtonLink"
@@ -9,41 +9,12 @@ import Translation from "../Translation"
99

1010
import { trackCustomEvent } from "../../utils/matomo"
1111

12-
const Container = styled.div`
13-
display: flex;
14-
flex-direction: column;
15-
background: ${({ theme }) => theme.colors.layer2Gradient};
16-
border-radius: 0.25rem;
17-
padding: 2rem;
18-
@media (max-width: ${(props) => props.theme.breakpoints.m}) {
19-
padding: 1.5rem;
20-
}
21-
span {
22-
color: ${({ theme }) => theme.colors.text200};
23-
}
24-
`
25-
26-
const SelectContainer = styled.div`
27-
margin: 1rem 0;
28-
`
12+
const StyledSelect = chakra(Select, {
13+
baseStyle: {
14+
maxW: { base: "full", md: "50%" },
15+
},
16+
})
2917

30-
const StyledSelect = styled(Select)`
31-
max-width: 50%;
32-
@media (max-width: ${({ theme }) => theme.breakpoints.m}) {
33-
max-width: 100%;
34-
}
35-
`
36-
37-
const ButtonContainer = styled.div`
38-
display: flex;
39-
flex-wrap: wrap;
40-
gap: 1rem;
41-
@media (max-width: ${(props) => props.theme.breakpoints.m}) {
42-
a {
43-
width: 100%;
44-
}
45-
}
46-
`
4718
export interface IProps {}
4819

4920
const StakingLaunchpadWidget: React.FC<IProps> = () => {
@@ -77,44 +48,54 @@ const StakingLaunchpadWidget: React.FC<IProps> = () => {
7748
}))
7849

7950
return (
80-
<Container>
81-
<div>
82-
<span>
83-
<Translation id="page-staking-launchpad-widget-span" />
84-
</span>
85-
<SelectContainer>
86-
<StyledSelect
87-
className="react-select-container"
88-
classNamePrefix="react-select"
89-
options={selectOptions}
90-
onChange={handleChange}
91-
defaultValue={selectOptions[0]}
92-
/>
93-
</SelectContainer>
94-
<p>
95-
<Translation id="page-staking-launchpad-widget-p1" />
96-
</p>
97-
<p>
98-
<Translation id="page-staking-launchpad-widget-p2" />
99-
</p>
100-
<ButtonContainer style={{ marginBottom: "1rem" }}>
101-
<ButtonLink to={data[selection].url}>
102-
{selection === "mainnet"
103-
? t("page-staking-launchpad-widget-mainnet-start")
104-
: t("page-staking-launchpad-widget-testnet-start")}
105-
</ButtonLink>
106-
</ButtonContainer>
107-
<p>
108-
<Translation id="page-staking-launchpad-widget-p3" />
109-
</p>
110-
<ButtonContainer>
111-
<ButtonLink to="#node-and-client-tools" variant="outline">
112-
<Emoji text="🛠" mr="1rem" />
113-
<Translation id="page-staking-launchpad-widget-link" />
114-
</ButtonLink>
115-
</ButtonContainer>
116-
</div>
117-
</Container>
51+
<Flex
52+
bg="layer2Gradient"
53+
borderRadius="base"
54+
flexDir="column"
55+
p={{ base: 6, md: 8 }}
56+
>
57+
<Text as="span" color="text200">
58+
<Translation id="page-staking-launchpad-widget-span" />
59+
</Text>
60+
<Box my={4}>
61+
<StyledSelect
62+
className="react-select-container"
63+
classNamePrefix="react-select"
64+
options={selectOptions}
65+
onChange={handleChange}
66+
defaultValue={selectOptions[0]}
67+
/>
68+
</Box>
69+
<Text>
70+
<Translation id="page-staking-launchpad-widget-p1" />
71+
</Text>
72+
<Text>
73+
<Translation id="page-staking-launchpad-widget-p2" />
74+
</Text>
75+
<Box mb={4}>
76+
<ButtonLink
77+
to={data[selection].url}
78+
width={{ base: "full", md: "auto" }}
79+
>
80+
{selection === "mainnet"
81+
? t("page-staking-launchpad-widget-mainnet-start")
82+
: t("page-staking-launchpad-widget-testnet-start")}
83+
</ButtonLink>
84+
</Box>
85+
<Text>
86+
<Translation id="page-staking-launchpad-widget-p3" />
87+
</Text>
88+
<Box>
89+
<ButtonLink
90+
to="#node-and-client-tools"
91+
variant="outline"
92+
width={{ base: "full", md: "auto" }}
93+
>
94+
<Emoji text="🛠" mr="1rem" />
95+
<Translation id="page-staking-launchpad-widget-link" />
96+
</ButtonLink>
97+
</Box>
98+
</Flex>
11899
)
119100
}
120101

0 commit comments

Comments
 (0)