Skip to content

Commit a1fbc1b

Browse files
authored
Merge pull request #13597 from ethereum/shadcn-get-eth
Shadcn migration - `/get-eth` page
2 parents f5a6de0 + 832017d commit a1fbc1b

File tree

4 files changed

+314
-412
lines changed

4 files changed

+314
-412
lines changed

src/components/BannerGrid/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ export const BannerGridCell = ({ children }: ChildOnlyProp) => {
3636
className={cn(
3737
"px-0 py-8 md:px-12",
3838
"flex-col",
39-
"border-t-search-background border-t",
40-
"md:border-s-search-background md:border-s",
39+
"border-t border-t-search-background",
40+
"md:border-s md:border-s-search-background",
4141
"first:border-t-0",
4242
"lg:[&:first-child]:border-s-0",
43-
"lg:[&:nth-child(-n+2)]:border-t-search-background md:[&:nth-child(-n+2)]:border-t-0 lg:[&:nth-child(-n+2)]:border-t",
44-
"lg:[&:nth-child(2n+1)]:border-s-search-background md:[&:nth-child(2n+1)]:border-s-0 lg:[&:nth-child(2n+1)]:border-s",
43+
"md:[&:nth-child(-n+2)]:border-t-0 lg:[&:nth-child(-n+2)]:border-t lg:[&:nth-child(-n+2)]:border-t-search-background",
44+
"md:[&:nth-child(2n+1)]:border-s-0 lg:[&:nth-child(2n+1)]:border-s lg:[&:nth-child(2n+1)]:border-s-search-background",
4545
"lg:[&:nth-child(-n+3)]:justify-start lg:[&:nth-child(-n+3)]:border-t-0 lg:[&:nth-child(-n+3)]:pt-0",
4646
"lg:[&:nth-child(3n+1)]:border-s-0 lg:[&:nth-child(3n+1)]:ps-0",
4747
"lg:[&:nth-child(n+4)]:justify-start lg:[&:nth-child(n+4)]:pb-0"

src/components/CentralizedExchanges/index.tsx

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,41 @@
11
import { useRouter } from "next/router"
22
import { useTranslation } from "next-i18next"
3-
import { Box, Center, Flex } from "@chakra-ui/react"
43

54
import type { ChildOnlyProp, Lang } from "@/lib/types"
65

76
import CardList from "@/components/CardList"
87
import Emoji from "@/components/Emoji"
9-
import InlineLink from "@/components/Link"
10-
import OldHeading from "@/components/OldHeading"
11-
import Text from "@/components/OldText"
128
import Select from "@/components/ui/Select"
139

1410
import { getLocaleTimestamp } from "@/lib/utils/time"
1511

1612
import { WEBSITE_EMAIL } from "@/lib/constants"
1713

14+
import InlineLink from "../ui/Link"
15+
1816
import { useCentralizedExchanges } from "@/hooks/useCentralizedExchanges"
1917

2018
const ListContainer = (props: ChildOnlyProp) => (
21-
<Box mt={16} flex={{ base: "1 1 100%", md: "1 1 50%" }} {...props} />
19+
<div className="mt-16 flex flex-col gap-4" {...props} />
2220
)
2321

2422
const ResultsContainer = (props: ChildOnlyProp) => (
25-
<Flex
26-
justify="center"
27-
w="full"
28-
maxWidth="876px"
29-
flexWrap={{ base: "wrap", md: "initial" }}
30-
sx={{
31-
"& > *": {
32-
_first: {
33-
me: { base: 0, md: 6 },
34-
},
35-
},
36-
}}
23+
<div
24+
className="flex w-full max-w-screen-md flex-wrap justify-center md:flex-nowrap first:md:me-6"
3725
{...props}
3826
/>
3927
)
4028

4129
const EmptyStateContainer = (props: ChildOnlyProp) => (
42-
<Center flexDir="column" mt={16} {...props} />
30+
<div className="mt-16 flex flex-col items-center justify-center" {...props} />
4331
)
4432

4533
const SuccessContainer = (props: ChildOnlyProp) => (
46-
<Flex flexDir="column" mt={4} {...props} />
34+
<div className="flex flex-col gap-4" {...props} />
4735
)
4836

4937
const EmptyStateText = (props: ChildOnlyProp) => (
50-
<Text m={8} fontSize="xl" maxW="450px" textAlign="center" {...props} />
38+
<p className="m-8 max-w-[450px] text-center text-xl" {...props} />
5139
)
5240

5341
const NoResults = ({ children }) => (
@@ -62,14 +50,14 @@ const NoResults = ({ children }) => (
6250
)
6351

6452
const NoResultsSingle = ({ children }) => (
65-
<Center flexDir="column" mt={6}>
66-
<Text maxW="450px" mb={16}>
53+
<div className="mt-6 flex flex-col items-center justify-center">
54+
<p className="mb-16 max-w-[450px]">
6755
{/* TODO: Fix `children` structure to include email link within i18n string */}
6856
{children}{" "}
6957
<InlineLink href={`mailto:${WEBSITE_EMAIL}`}>{WEBSITE_EMAIL}</InlineLink>.
70-
</Text>
58+
</p>
7159
<Emoji text=":crying_face:" className="text-[80px]" />
72-
</Center>
60+
</div>
7361
)
7462

7563
type CentralizedExchangesProps = { lastDataUpdateDate: string }
@@ -91,18 +79,12 @@ const CentralizedExchanges = ({
9179
const lastUpdated = getLocaleTimestamp(locale as Lang, lastDataUpdateDate)
9280

9381
return (
94-
<Flex flexDir="column" align="center" w="full">
95-
<OldHeading
96-
fontSize={{ base: "2xl", md: "2rem" }}
97-
fontWeight={600}
98-
lineHeight={1.4}
99-
>
100-
{t("page-get-eth-exchanges-header")}
101-
</OldHeading>
102-
<Text maxW="container.sm" mb={8} lineHeight={1.4} textAlign="center">
82+
<div className="flex flex-col items-center">
83+
<h2 className="mb-4">{t("page-get-eth-exchanges-header")}</h2>
84+
<p className="mb-8 max-w-screen-md text-center">
10385
{t("page-get-eth-exchanges-intro")}
104-
</Text>
105-
<Box w="full" maxW="container.sm">
86+
</p>
87+
<div className="w-full max-w-screen-sm">
10688
<Select
10789
instanceId="eth-exchange-region"
10890
aria-label={t("page-get-eth-exchanges-header")}
@@ -112,7 +94,7 @@ const CentralizedExchanges = ({
11294
isSearchable
11395
variant="outline"
11496
/>
115-
</Box>
97+
</div>
11698
{!hasSelectedCountry && (
11799
<EmptyStateContainer>
118100
<Emoji text=":world_map:" className="text-[80px]" />
@@ -134,17 +116,12 @@ const CentralizedExchanges = ({
134116
<>
135117
<ResultsContainer>
136118
<ListContainer>
137-
<OldHeading
138-
as="h3"
139-
fontSize={{ base: "xl", md: "2xl" }}
140-
fontWeight={600}
141-
lineHeight={1.4}
142-
>
119+
<h3 className="text-xl font-semibold md:text-2xl">
143120
{t("page-get-eth-exchanges-header-exchanges")}
144-
</OldHeading>
121+
</h3>
145122
{hasExchangeResults && (
146123
<SuccessContainer>
147-
<Text>{t("page-get-eth-exchanges-success-exchange")}</Text>
124+
<p>{t("page-get-eth-exchanges-success-exchange")}</p>
148125
<CardList items={filteredExchanges} />
149126
</SuccessContainer>
150127
)}
@@ -155,17 +132,17 @@ const CentralizedExchanges = ({
155132
)}
156133
</ListContainer>
157134
</ResultsContainer>
158-
<Text w="full" maxW="876px" mt={16} mb={0}>
135+
<p className="mt-16 max-w-screen-lg">
159136
{t("page-get-eth-exchanges-disclaimer")}{" "}
160137
<InlineLink href={`mailto:${WEBSITE_EMAIL}`}>
161138
{WEBSITE_EMAIL}
162139
</InlineLink>
163140
. {t("page-find-wallet-last-updated")}{" "}
164141
<strong>{lastUpdated}</strong>
165-
</Text>
142+
</p>
166143
</>
167144
)}
168-
</Flex>
145+
</div>
169146
)
170147
}
171148

src/components/ui/buttons/Button.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
126126
)
127127
Button.displayName = "Button"
128128

129-
type ButtonLinkProps = Omit<LinkProps, "onClick"> &
129+
type ButtonLinkProps = LinkProps &
130130
Pick<ButtonProps, "size" | "variant" | "isSecondary"> & {
131131
buttonProps?: Omit<ButtonProps, "size" | "variant">
132132
customEventOptions?: MatomoEventOptions
@@ -139,15 +139,19 @@ const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
139139
variant,
140140
isSecondary,
141141
buttonProps,
142+
onClick,
142143
customEventOptions,
143144
children,
144145
className,
145146
...linkProps
146147
},
147148
ref
148149
) => {
149-
const handleClick = () => {
150+
const handleClick: React.MouseEventHandler<HTMLAnchorElement> = (
151+
...args
152+
) => {
150153
customEventOptions && trackCustomEvent(customEventOptions)
154+
onClick?.(...args)
151155
}
152156
return (
153157
<Button

0 commit comments

Comments
 (0)