Skip to content

Commit e1ab77d

Browse files
committed
Migrate acknowledgements page to Shadcn
1 parent ecca401 commit e1ab77d

File tree

1 file changed

+55
-79
lines changed

1 file changed

+55
-79
lines changed

src/pages/contributing/translation-program/acknowledgements.tsx

Lines changed: 55 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
1+
import { BaseHTMLAttributes } from "react"
12
import { useRouter } from "next/router"
23
import { GetStaticProps } from "next/types"
34
import { useTranslation } from "next-i18next"
45
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
5-
import {
6-
Box,
7-
BoxProps,
8-
Flex,
9-
HeadingProps,
10-
List,
11-
ListItem,
12-
useColorModeValue,
13-
} from "@chakra-ui/react"
6+
import { useColorModeValue } from "@chakra-ui/react"
147

158
import { BasePageProps, Lang } from "@/lib/types"
169

1710
import ActionCard from "@/components/ActionCard"
1811
import Breadcrumbs from "@/components/Breadcrumbs"
1912
import FeedbackCard from "@/components/FeedbackCard"
20-
import { Image } from "@/components/Image"
21-
import InlineLink from "@/components/Link"
22-
import MainArticle from "@/components/MainArticle"
23-
import OldHeading from "@/components/OldHeading"
24-
import Text from "@/components/OldText"
13+
import { TwImage } from "@/components/Image"
2514
import PageMetadata from "@/components/PageMetadata"
2615
import TranslationLeaderboard from "@/components/TranslationLeaderboard"
16+
import { Flex } from "@/components/ui/flex"
17+
import InlineLink from "@/components/ui/Link"
18+
import { ListItem, OrderedList } from "@/components/ui/list"
2719

20+
import { cn } from "@/lib/utils/cn"
2821
import { existsNamespace } from "@/lib/utils/existsNamespace"
2922
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
3023
import { getLocaleTimestamp } from "@/lib/utils/time"
@@ -39,12 +32,31 @@ import lightThemeCertificateImg from "@/public/images/certificates/light-certifi
3932
import dogeComputerImg from "@/public/images/doge-computer.png"
4033
import whatIsEthereumImg from "@/public/images/what-is-ethereum.png"
4134

42-
const Content = (props: BoxProps) => (
43-
<Box as={MainArticle} py={4} px={10} w="full" {...props} />
35+
const Content = ({
36+
className,
37+
...props
38+
}: BaseHTMLAttributes<HTMLHeadingElement>) => (
39+
<div className={cn("w-full px-10 py-4", className)} {...props} />
4440
)
4541

46-
const ContentHeading = (props: HeadingProps) => (
47-
<OldHeading lineHeight={1.4} {...props} />
42+
const H2 = ({
43+
className,
44+
...props
45+
}: BaseHTMLAttributes<HTMLHeadingElement>) => (
46+
<h2
47+
className={cn(
48+
"mb-8 mt-12 text-2xl font-semibold leading-xs md:text-[2rem]",
49+
className
50+
)}
51+
{...props}
52+
/>
53+
)
54+
55+
const Text = ({
56+
className,
57+
...props
58+
}: BaseHTMLAttributes<HTMLHeadingElement>) => (
59+
<p className={cn("mb-[1.45rem] leading-[1.6rem]", className)} {...props} />
4860
)
4961

5062
export const getStaticProps = (async ({ locale }) => {
@@ -81,7 +93,7 @@ const TranslatorAcknowledgements = () => {
8193
)
8294

8395
return (
84-
<Flex direction="column" align="center" w="full">
96+
<Flex className="w-full flex-col items-center">
8597
<PageMetadata
8698
title={t(
8799
"page-contributing-translation-program-acknowledgements-meta-title"
@@ -93,26 +105,14 @@ const TranslatorAcknowledgements = () => {
93105

94106
<Content>
95107
<Breadcrumbs slug={router.asPath} className="mt-12" />
96-
<ContentHeading
97-
as="h1"
98-
fontSize={{ base: "2rem", sm: "2.5rem", md: "5xl" }}
99-
>
108+
<h1 className="my-8 text-[2rem] leading-xs sm:text-[2.5rem] md:text-5xl">
100109
{t(
101110
"page-contributing-translation-program-acknowledgements-acknowledgement-page-title"
102111
)}
103-
</ContentHeading>
104-
<Flex
105-
direction={{ base: "column", lg: "row" }}
106-
align={{ base: "flex-start", lg: "normal" }}
107-
w="full"
108-
ms={0}
109-
me={{ base: 0, lg: 8 }}
110-
>
112+
</h1>
113+
<Flex className="me-0 ms-0 w-full flex-col items-start lg:me-8 lg:flex-row lg:items-center">
111114
{/* LEFT COLUMN */}
112-
<Box
113-
m={{ base: "auto 0", lg: "0 2rem 0 0" }}
114-
w={{ base: "full", lg: "50%" }}
115-
>
115+
<div className="m-auto w-full lg:mb-0 lg:ml-0 lg:mr-8 lg:mt-0 lg:w-1/2">
116116
<Text>
117117
{t(
118118
"page-contributing-translation-program-acknowledgements-acknowledgement-page-1"
@@ -143,34 +143,26 @@ const TranslatorAcknowledgements = () => {
143143
{/* <p>
144144
<Translation id="page-contributing-translation-program-acknowledgements-acknowledgement-page-5" />
145145
</p> */}
146-
</Box>
146+
</div>
147147
{/* RIGHT COLUMN */}
148-
<Box
149-
m={{ base: "auto 0", lg: "0 0 0 2rem" }}
150-
w={{ base: "full", lg: "50%" }}
151-
>
152-
<Image
148+
<div className="m-auto w-full lg:mb-0 lg:ml-8 lg:mr-0 lg:mt-0 lg:w-1/2">
149+
<TwImage
150+
width={500}
153151
src={dogeComputerImg}
154-
w={500}
155152
alt={t(
156153
"page-contributing-translation-program-acknowledgements-hero-image-alt"
157154
)}
158155
/>
159-
</Box>
156+
</div>
160157
</Flex>
161158
</Content>
162159

163-
<Content maxW="800px">
164-
<ContentHeading
165-
as="h2"
166-
textAlign="center"
167-
fontSize={{ base: "2xl", md: "2rem" }}
168-
fontWeight={600}
169-
>
160+
<Content className="max-w-[800px]">
161+
<H2 className="text-center">
170162
{t(
171163
"page-contributing-translation-program-acknowledgements-translation-leaderboard-title"
172164
)}
173-
</ContentHeading>
165+
</H2>
174166
<TranslationLeaderboard
175167
monthData={monthData}
176168
quarterData={quarterData}
@@ -184,15 +176,11 @@ const TranslatorAcknowledgements = () => {
184176
</Content>
185177

186178
<Content>
187-
<ContentHeading
188-
as="h2"
189-
fontSize={{ base: "2xl", md: "2rem" }}
190-
fontWeight={600}
191-
>
179+
<H2>
192180
{t(
193181
"page-contributing-translation-program-acknowledgements-our-translators-title"
194182
)}
195-
</ContentHeading>
183+
</H2>
196184
<Text>
197185
{t(
198186
"page-contributing-translation-program-acknowledgements-our-translators-1"
@@ -213,15 +201,11 @@ const TranslatorAcknowledgements = () => {
213201
</Content>
214202

215203
<Content id="certificate">
216-
<ContentHeading
217-
as="h2"
218-
fontSize={{ base: "2xl", md: "2rem" }}
219-
fontWeight={600}
220-
>
204+
<H2>
221205
{t(
222206
"page-contributing-translation-program-acknowledgements-cert-title"
223207
)}
224-
</ContentHeading>
208+
</H2>
225209
<Text>
226210
{t("page-contributing-translation-program-acknowledgements-cert-1")}
227211
</Text>
@@ -231,21 +215,17 @@ const TranslatorAcknowledgements = () => {
231215
<Text>
232216
{t("page-contributing-translation-program-acknowledgements-cert-3")}
233217
</Text>
234-
<Flex justify="center">
235-
<Image src={themedCertificateImage} alt="translator certificate" />
218+
<Flex className="justify-center">
219+
<TwImage src={themedCertificateImage} alt="translator certificate" />
236220
</Flex>
237221
</Content>
238222

239223
<Content id="oats">
240-
<ContentHeading
241-
as="h2"
242-
fontSize={{ base: "2xl", md: "2rem" }}
243-
fontWeight={600}
244-
>
224+
<H2>
245225
{t(
246226
"page-contributing-translation-program-acknowledgements-oats-title"
247227
)}
248-
</ContentHeading>
228+
</H2>
249229
<Text>
250230
{t("page-contributing-translation-program-acknowledgements-1")}
251231
</Text>
@@ -255,17 +235,13 @@ const TranslatorAcknowledgements = () => {
255235
<Text>
256236
{t("page-contributing-translation-program-acknowledgements-3")}
257237
</Text>
258-
<ContentHeading
259-
as="h3"
260-
fontSize={{ base: "xl", md: "2xl" }}
261-
fontWeight={600}
262-
>
238+
<h3 className="mb-8 mt-10 text-xl font-semibold leading-xs md:text-2xl">
263239
{t(
264240
"page-contributing-translation-program-acknowledgements-how-to-claim-title"
265241
)}
266-
</ContentHeading>
242+
</h3>
267243

268-
<List as="ol" styleType="decimal">
244+
<OrderedList>
269245
<ListItem>
270246
{t(
271247
"page-contributing-translation-program-acknowledgements-how-to-claim-1"
@@ -291,7 +267,7 @@ const TranslatorAcknowledgements = () => {
291267
"page-contributing-translation-program-acknowledgements-how-to-claim-4"
292268
)}
293269
</ListItem>
294-
</List>
270+
</OrderedList>
295271
<Text>
296272
{t("page-contributing-translation-program-acknowledgements-4")}
297273
</Text>

0 commit comments

Comments
 (0)