Skip to content

Commit 25430bc

Browse files
authored
Merge pull request ethereum#14765 from JoeChenJ/Shadcn_Migrate_assets.tsx
Shadcn Migrate: assets.tsx
2 parents 0bbcd6a + ee11140 commit 25430bc

File tree

1 file changed

+18
-43
lines changed

1 file changed

+18
-43
lines changed

src/pages/assets.tsx

Lines changed: 18 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
1+
import { HTMLAttributes } from "react"
12
import type { GetStaticProps } from "next/types"
23
import { useTranslation } from "next-i18next"
34
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
4-
import {
5-
Box,
6-
Center,
7-
Flex,
8-
Heading,
9-
type HeadingProps,
10-
SimpleGrid,
11-
type SimpleGridProps,
12-
useColorModeValue,
13-
} from "@chakra-ui/react"
145

156
import type { BasePageProps, ChildOnlyProp, Lang } from "@/lib/types"
167

178
import AssetDownload from "@/components/AssetDownload"
189
import FeedbackCard from "@/components/FeedbackCard"
19-
import { Image } from "@/components/Image"
20-
import InlineLink from "@/components/Link"
10+
import { TwImage } from "@/components/Image"
2111
import MainArticle from "@/components/MainArticle"
22-
import OldHeading from "@/components/OldHeading"
2312
import PageMetadata from "@/components/PageMetadata"
13+
import { Center, Flex } from "@/components/ui/flex"
14+
import InlineLink from "@/components/ui/Link"
2415

2516
import { existsNamespace } from "@/lib/utils/existsNamespace"
2617
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
@@ -37,6 +28,7 @@ import { getLocaleTimestamp } from "@/lib/utils/time"
3728
// import leslieTheRhino from "@/public/images/upgrades/upgrade_rhino.png"
3829
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
3930

31+
import useColorModeValue from "@/hooks/useColorModeValue"
4032
import ethDiamondBlack from "@/public/images/assets/eth-diamond-black.png"
4133
import ethDiamondBlackGray from "@/public/images/assets/eth-diamond-black-gray.png"
4234
import ethDiamondBlackWhite from "@/public/images/assets/eth-diamond-black-white.jpg"
@@ -89,34 +81,19 @@ import defi from "@/public/images/use-cases/defi.png"
8981
import wallet from "@/public/images/wallet.png"
9082
import whatIsEthereum from "@/public/images/what-is-ethereum.png"
9183

92-
const Row = (props: SimpleGridProps) => (
93-
<SimpleGrid
94-
templateColumns="repeat(auto-fit, minmax(min(288px, 100%), 1fr))"
95-
mx={-4}
96-
mb="8"
84+
const Row = (props: ChildOnlyProp) => (
85+
<div
86+
className="-mx-4 mb-8 grid grid-cols-[repeat(auto-fit,minmax(min(288px,100%),1fr))]"
9787
{...props}
9888
/>
9989
)
10090

101-
const H2 = (props: ChildOnlyProp & HeadingProps) => (
102-
<Heading
103-
fontSize={{ base: "2xl", md: "3xl" }}
104-
lineHeight={1.4}
105-
mt={16}
106-
mb="6"
107-
scrollMarginTop={24}
108-
{...props}
109-
/>
91+
const H2 = (props: HTMLAttributes<HTMLHeadingElement>) => (
92+
<h2 className="mb-6 mt-16 scroll-mt-24 leading-xs" {...props} />
11093
)
11194

11295
const H3 = (props: ChildOnlyProp) => (
113-
<OldHeading
114-
as="h3"
115-
fontSize={{ base: "xl", md: "2xl" }}
116-
lineHeight={1.4}
117-
mb="0"
118-
{...props}
119-
/>
96+
<h3 className="mb-0 mt-10 leading-xs" {...props} />
12097
)
12198

12299
export const getStaticProps = (async ({ locale }) => {
@@ -146,24 +123,22 @@ const AssetsPage = () => {
146123
ethDiamondPurple
147124
)
148125
return (
149-
<Flex direction="column" width="full">
126+
<Flex className="w-full flex-col">
150127
<PageMetadata
151128
title={t("page-assets-meta-title")}
152129
description={t("page-assets-meta-desc")}
153130
/>
154-
<Box as={MainArticle} py="4" px="8">
155-
<Flex direction="column" px="8" py="4">
131+
<MainArticle className="px-8 py-4">
132+
<Flex className="flex-col px-8 py-4">
156133
<Center>
157-
<Image
134+
<TwImage
135+
className="w-20"
158136
src={assetPageHeroImage}
159137
alt={t("page-assets-eth-diamond-gray")}
160-
w="5rem"
161138
/>
162139
</Center>
163140
<Center>
164-
<Heading as="h1" size="2xl" my="8">
165-
{t("page-assets-h1")}
166-
</Heading>
141+
<h1 className="my-8">{t("page-assets-h1")}</h1>
167142
</Center>
168143
<Center>
169144
<InlineLink href="/assets/#illustrations">
@@ -562,7 +537,7 @@ const AssetsPage = () => {
562537
svgUrl="/images/assets/svgs/merge-panda.svg"
563538
/>
564539
</Row>
565-
</Box>
540+
</MainArticle>
566541
<FeedbackCard />
567542
</Flex>
568543
)

0 commit comments

Comments
 (0)