Skip to content

Commit 3989e43

Browse files
committed
Migrate developers/local-environment.tsx to Shadcn
1 parent 4051a0b commit 3989e43

File tree

1 file changed

+23
-54
lines changed

1 file changed

+23
-54
lines changed

src/pages/developers/local-environment.tsx

Lines changed: 23 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1+
import { HTMLAttributes } from "react"
12
import { GetStaticProps, InferGetStaticPropsType } from "next"
23
import { useTranslation } from "next-i18next"
34
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
4-
import {
5-
Box,
6-
Flex,
7-
ListItem,
8-
SimpleGrid,
9-
UnorderedList,
10-
} from "@chakra-ui/react"
115

126
import { BasePageProps, ChildOnlyProp, Lang } from "@/lib/types"
137
import { Framework } from "@/lib/interfaces"
148

159
import FeedbackCard from "@/components/FeedbackCard"
16-
import { Image } from "@/components/Image"
10+
import Heading from "@/components/Heading"
11+
import { TwImage } from "@/components/Image"
1712
import MainArticle from "@/components/MainArticle"
18-
import Heading from "@/components/OldHeading"
19-
import Text from "@/components/OldText"
2013
import PageMetadata from "@/components/PageMetadata"
2114
import ProductCard from "@/components/ProductCard"
2215
import Translation from "@/components/Translation"
16+
import { Flex, VStack } from "@/components/ui/flex"
17+
import { ListItem, UnorderedList } from "@/components/ui/list"
2318

19+
import { cn } from "@/lib/utils/cn"
2420
import { dataLoader } from "@/lib/utils/data/dataLoader"
2521
import { existsNamespace } from "@/lib/utils/existsNamespace"
2622
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
@@ -31,28 +27,21 @@ import { getLocalEnvironmentFrameworkData } from "@/lib/api/ghRepoData"
3127
import EthBlocksImage from "@/public/images/developers-eth-blocks.png"
3228

3329
const Content = ({ children }: ChildOnlyProp) => {
34-
return (
35-
<Box as={MainArticle} py={4} px={8} w="full">
36-
{children}
37-
</Box>
38-
)
30+
return <MainArticle className="w-full px-8 py-4">{children}</MainArticle>
3931
}
4032

4133
const Column = ({ children }: ChildOnlyProp) => {
4234
return (
43-
<Box
44-
flex="1 0 33%"
45-
justifyContent="flex-end"
46-
mb={6}
47-
me={8}
48-
w="full"
49-
maxW={{ base: "full", md: "none" }}
50-
>
35+
<div className="mb-6 me-8 w-full max-w-full flex-shrink-0 flex-grow basis-1/3 justify-end md:max-w-none">
5136
{children}
52-
</Box>
37+
</div>
5338
)
5439
}
5540

41+
const Text = ({ className, ...props }: HTMLAttributes<HTMLHeadingElement>) => (
42+
<p className={cn("mb-6", className)} {...props} />
43+
)
44+
5645
const loadData = dataLoader([
5746
["frameworksListData", getLocalEnvironmentFrameworkData],
5847
])
@@ -92,19 +81,12 @@ const LocalEnvironmentPage = ({
9281
const { t } = useTranslation("page-developers-local-environment")
9382

9483
return (
95-
<Flex direction="column" alignItems="center" w="full" mx="auto" mt={16}>
84+
<VStack className="mx-auto mt-16 w-full">
9685
<PageMetadata
9786
title={t("page-local-environment-setup-meta-title")}
9887
description={t("page-local-environment-setup-meta-desc")}
9988
/>
100-
<Box
101-
pt={{ base: 0, xl: 4 }}
102-
pb={{ base: 8, xl: 4 }}
103-
px={8}
104-
w="full"
105-
mb={8}
106-
justifyContent="center"
107-
>
89+
<div className="mb-8 w-full justify-center px-8 pb-8 pt-0 xl:pb-4 xl:pt-4">
10890
<Heading
10991
as="h1"
11092
fontStyle="normal"
@@ -119,25 +101,14 @@ const LocalEnvironmentPage = ({
119101
>
120102
<Translation id="page-developers-local-environment:page-local-environment-setup-title" />
121103
</Heading>
122-
<Text
123-
fontSize="xl"
124-
lineHeight={1.4}
125-
color="text200"
126-
mb={2}
127-
textAlign="center"
128-
>
104+
<Text className="mb-2 text-center leading-xs text-body-medium">
129105
<Translation id="page-developers-local-environment:page-local-environment-setup-subtitle" />
130106
<br />
131107
<Translation id="page-developers-local-environment:page-local-environment-setup-subtitle-2" />
132108
</Text>
133-
</Box>
109+
</div>
134110
<Content>
135-
<Flex
136-
direction={{ base: "column-reverse", lg: "row" }}
137-
alignItems={{ base: "flex-start", lg: "center" }}
138-
w="full"
139-
justifyContent="space-between"
140-
>
111+
<Flex className="w-full flex-col-reverse items-start justify-between lg:flex-row lg:items-center">
141112
<Column>
142113
<Heading
143114
fontSize={{ base: "2xl", md: "2rem" }}
@@ -172,17 +143,15 @@ const LocalEnvironmentPage = ({
172143
</UnorderedList>
173144
</Column>
174145
<Column>
175-
<Image
176-
flex="1 1 100%"
177-
backgroundSize="cover"
178-
backgroundRepeat="no-repeat"
146+
<TwImage
147+
className="flex-1 basis-full bg-cover bg-no-repeat"
179148
src={EthBlocksImage}
180149
alt={t("page-developers-index:alt-eth-blocks")}
181150
loading="eager"
182151
/>
183152
</Column>
184153
</Flex>
185-
<SimpleGrid minChildWidth="min(100%, 280px)" spacing={8}>
154+
<div className="grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
186155
{frameworksList.map((framework, idx) => (
187156
<ProductCard
188157
key={idx}
@@ -198,12 +167,12 @@ const LocalEnvironmentPage = ({
198167
{t(framework.description)}
199168
</ProductCard>
200169
))}
201-
</SimpleGrid>
170+
</div>
202171
</Content>
203172
<Content>
204173
<FeedbackCard />
205174
</Content>
206-
</Flex>
175+
</VStack>
207176
)
208177
}
209178

0 commit comments

Comments
 (0)