Skip to content

Commit 6808445

Browse files
authored
Merge pull request #8720 from soheil555/feat/beacon-chain-actions-to-chakra
Migrate `BeaconChainActions` to Chakra
2 parents 7a70d77 + 8a18427 commit 6808445

File tree

2 files changed

+35
-57
lines changed

2 files changed

+35
-57
lines changed

src/components/BeaconChainActions.tsx

Lines changed: 31 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from "react"
2+
import { Box, Flex, Heading } from "@chakra-ui/react"
3+
24
import { useStaticQuery, graphql } from "gatsby"
3-
import styled from "@emotion/styled"
5+
46
import { useIntl } from "react-intl"
57

68
import { translateMessageId } from "../utils/translations"
@@ -13,50 +15,17 @@ import Translation from "./Translation"
1315

1416
import type { CardListItem } from "./CardList"
1517

16-
const Container = styled.div`
17-
margin-bottom: 4rem;
18-
`
19-
20-
const StyledCardContainer = styled.div`
21-
display: flex;
22-
padding-top: 1rem;
23-
@media (max-width: ${(props) => props.theme.breakpoints.m}) {
24-
flex-direction: column;
25-
}
26-
`
27-
28-
const StyledCardLeft = styled(Card)`
29-
margin-left: 0rem;
30-
margin-right: 1rem;
31-
width: 100%;
32-
@media (max-width: ${(props) => props.theme.breakpoints.m}) {
33-
margin-right: 0rem;
34-
margin-bottom: 2rem;
35-
}
36-
`
37-
38-
const StyledCardRight = styled(Card)`
39-
margin-left: 0rem;
40-
margin-left: 1rem;
41-
width: 100%;
42-
@media (max-width: ${(props) => props.theme.breakpoints.m}) {
43-
margin-left: 0rem;
44-
}
45-
`
46-
47-
const H3 = styled.h3`
48-
font-size: 1.5rem;
49-
font-weight: 700;
50-
margin-bottom: 2rem;
51-
52-
a {
53-
display: none;
54-
}
55-
`
56-
57-
const StyledButtonLink = styled(ButtonLink)`
58-
margin-bottom: 0.75rem;
59-
`
18+
const H3: React.FC<{ children: React.ReactNode }> = ({ children }) => (
19+
<Heading
20+
as="h3"
21+
fontSize="2xl"
22+
fontWeight="bold"
23+
mb={8}
24+
sx={{ a: { display: "none" } }}
25+
>
26+
{children}
27+
</Heading>
28+
)
6029

6130
export const DataLogo = graphql`
6231
fragment DataLogo on File {
@@ -140,21 +109,28 @@ const BeaconChainActions: React.FC = () => {
140109
]
141110

142111
return (
143-
<Container>
144-
<StyledCardContainer>
145-
<StyledCardLeft
112+
<Box mb={16}>
113+
<Flex flexDir={{ base: "column", md: "row" }} pt={4}>
114+
<Card
115+
w="full"
116+
ml={0}
117+
mr={{ base: 0, md: 4 }}
118+
mb={{ base: 8, md: 0 }}
146119
emoji=":money_with_wings:"
147120
title={translateMessageId("consensus-become-staker", intl)}
148121
description={translateMessageId("consensus-become-staker-desc", intl)}
149122
>
150-
<StyledButtonLink to="https://launchpad.ethereum.org">
123+
<ButtonLink mb={3} to="https://launchpad.ethereum.org">
151124
<Translation id="get-started" />
152-
</StyledButtonLink>
125+
</ButtonLink>
153126
<ButtonLink variant="outline" to="/staking/">
154127
<Translation id="page-upgrades-index-staking-learn" />
155128
</ButtonLink>
156-
</StyledCardLeft>
157-
<StyledCardRight
129+
</Card>
130+
<Card
131+
w="full"
132+
mr={0}
133+
ml={{ base: 0, md: 4 }}
158134
emoji=":computer:"
159135
title={translateMessageId("consensus-run-beacon-chain", intl)}
160136
description={translateMessageId(
@@ -165,8 +141,8 @@ const BeaconChainActions: React.FC = () => {
165141
<ButtonLink variant="outline" to="/upgrades/get-involved/">
166142
<Translation id="consensus-run-beacon-chain" />
167143
</ButtonLink>
168-
</StyledCardRight>
169-
</StyledCardContainer>
144+
</Card>
145+
</Flex>
170146
<H3>
171147
<Translation id="consensus-explore" />
172148
</H3>
@@ -176,7 +152,7 @@ const BeaconChainActions: React.FC = () => {
176152
<Translation id="read-more" />
177153
</H3>
178154
<CardList content={reads} />
179-
</Container>
155+
</Box>
180156
)
181157
}
182158

src/components/Card.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { ReactNode } from "react"
2-
import { Flex, Heading, Text } from "@chakra-ui/react"
2+
import { ChakraProps, Flex, Heading, Text } from "@chakra-ui/react"
33
import Emoji from "./Emoji"
44

5-
export interface IProps {
5+
export interface IProps extends ChakraProps {
66
children?: React.ReactNode
77
emoji?: string
88
title?: ReactNode
@@ -16,6 +16,7 @@ const Card: React.FC<IProps> = ({
1616
description,
1717
children,
1818
className,
19+
...props
1920
}) => (
2021
<Flex
2122
direction="column"
@@ -28,6 +29,7 @@ const Card: React.FC<IProps> = ({
2829
borderColor="lightBorder"
2930
p={6}
3031
className={className}
32+
{...props}
3133
>
3234
<div>
3335
{emoji && <Emoji fontSize="5xl" text={emoji} mb={4} />}

0 commit comments

Comments
 (0)