Skip to content

Commit 0e9b8c7

Browse files
authored
Merge pull request #14706 from MahendraBishnoi29/browny_tailwind_migration
migrate `learning-tools.tsx` page to Tailwind
2 parents 214b237 + 96eda55 commit 0e9b8c7

File tree

2 files changed

+65
-66
lines changed

2 files changed

+65
-66
lines changed

src/pages/developers/learning-tools.tsx

Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1+
import { BaseHTMLAttributes } from "react"
12
import shuffle from "lodash/shuffle"
23
import { GetStaticProps } from "next"
34
import { useTranslation } from "next-i18next"
45
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
5-
import { Box, Flex, HeadingProps } from "@chakra-ui/react"
66

7-
import { BasePageProps, ChildOnlyProp, Lang, LearningTool } from "@/lib/types"
7+
import { BasePageProps, Lang, LearningTool } from "@/lib/types"
88

99
import ButtonLink from "@/components/Buttons/ButtonLink"
1010
import CalloutBanner from "@/components/CalloutBanner"
1111
import FeedbackCard from "@/components/FeedbackCard"
1212
import InfoBanner from "@/components/InfoBanner"
1313
import LearningToolsCardGrid from "@/components/LearningToolsCardGrid"
1414
import MainArticle from "@/components/MainArticle"
15-
import Heading from "@/components/OldHeading"
16-
import Text from "@/components/OldText"
1715
import PageMetadata from "@/components/PageMetadata"
1816
import Translation from "@/components/Translation"
1917

18+
import { cn } from "@/lib/utils/cn"
2019
import { existsNamespace } from "@/lib/utils/existsNamespace"
2120
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
2221
import { getLocaleTimestamp } from "@/lib/utils/time"
@@ -45,77 +44,75 @@ import SpeedRunEthereumImage from "@/public/images/dev-tools/speed-run-ethereum.
4544
import TenderlyImage from "@/public/images/dev-tools/tenderly.png"
4645
import EnterpriseEth from "@/public/images/enterprise-eth.png"
4746

48-
const Page = (props: ChildOnlyProp) => (
49-
<Flex
50-
direction="column"
51-
align="center"
52-
w="full"
53-
mx="auto"
54-
mt={16}
55-
mb={0}
47+
const Page = ({ className, ...props }: BaseHTMLAttributes<HTMLDivElement>) => (
48+
<div
49+
className={cn(
50+
"mx-auto mb-0 mt-16 flex w-full flex-col items-center",
51+
className
52+
)}
5653
{...props}
5754
/>
5855
)
5956

60-
const Header = (props: ChildOnlyProp) => (
61-
<Flex
62-
as="header"
63-
direction="column"
64-
align="center"
65-
textAlign="center"
66-
maxW="896px"
67-
py={0}
68-
px={8}
69-
m="auto"
57+
const Header = ({ className, ...props }: BaseHTMLAttributes<HTMLElement>) => (
58+
<header
59+
className={cn(
60+
"m-auto flex max-w-[896px] flex-col items-center px-8 py-0 text-center",
61+
className
62+
)}
7063
{...props}
7164
/>
7265
)
7366

74-
const H1 = (props: ChildOnlyProp) => (
75-
<Heading
76-
as="h1"
77-
color="text"
78-
fontStyle="normal"
79-
fontFamily="monospace"
80-
textTransform="uppercase"
81-
fontWeight="semibold"
82-
fontSize="2rem"
83-
lineHeight={1.4}
84-
textAlign="center"
67+
const H1 = ({
68+
className,
69+
...props
70+
}: BaseHTMLAttributes<HTMLHeadingElement>) => (
71+
<h1
72+
className={cn(
73+
"my-8 text-center font-mono text-3xl font-semibold uppercase leading-[1.4]",
74+
className
75+
)}
8576
{...props}
8677
/>
8778
)
8879

89-
const Subtitle = (props: HeadingProps) => (
90-
<Heading
91-
fontSize="xl"
92-
lineHeight={1.4}
93-
fontWeight="normal"
94-
color="text300"
95-
maxW="55ch"
96-
mb={2}
97-
mt={4}
80+
const Subtitle = ({
81+
className,
82+
...props
83+
}: BaseHTMLAttributes<HTMLHeadingElement>) => (
84+
<h2
85+
className={cn(
86+
"text-text300 mb-2 mt-4 max-w-[55ch] text-xl font-normal leading-[1.4]",
87+
className
88+
)}
9889
{...props}
9990
/>
10091
)
10192

102-
const SubtitleTwo = (props: ChildOnlyProp) => <Subtitle mt={0} {...props} />
93+
const SubtitleTwo = ({
94+
className,
95+
...props
96+
}: BaseHTMLAttributes<HTMLHeadingElement>) => (
97+
<Subtitle className={cn("mt-0", className)} {...props} />
98+
)
10399

104-
const ContentBox = (props: ChildOnlyProp) => (
105-
<Box py={4} px={8} w="full" {...props} />
100+
const ContentBox = ({
101+
className,
102+
...props
103+
}: BaseHTMLAttributes<HTMLDivElement>) => (
104+
<div className={cn("w-full px-8 py-4", className)} {...props} />
106105
)
107106

108-
const StackContainer = (props: ChildOnlyProp) => (
109-
<Box
110-
border="1px"
111-
borderColor="border"
112-
borderRadius={{ base: 0, sm: "base" }}
113-
w={{ base: "full", sm: "96%" }}
114-
mx={{ base: 0, sm: 8 }}
115-
my={8}
116-
px={8}
117-
py={12}
118-
background="ednBackground"
107+
const StackContainer = ({
108+
className,
109+
...props
110+
}: BaseHTMLAttributes<HTMLDivElement>) => (
111+
<div
112+
className={cn(
113+
"mx-0 my-8 w-full border bg-background-highlight px-8 py-12 sm:mx-8 sm:w-[96%] sm:rounded",
114+
className
115+
)}
119116
{...props}
120117
/>
121118
)
@@ -439,7 +436,7 @@ const LearningToolsPage = () => {
439436
)}
440437
/>
441438
<MainArticle className="w-full">
442-
<Box w="full">
439+
<div className="w-full">
443440
<Header>
444441
<H1>
445442
<Translation id="page-developers-learning-tools:page-learning-tools-coding" />
@@ -448,14 +445,14 @@ const LearningToolsPage = () => {
448445
<Translation id="page-developers-learning-tools:page-learning-tools-coding-subtitle" />
449446
</Subtitle>
450447
</Header>
451-
</Box>
448+
</div>
452449
<StackContainer>
453450
<SubtitleTwo>
454451
<Translation id="page-developers-learning-tools:page-learning-tools-sandbox" />
455452
</SubtitleTwo>
456-
<Text>
453+
<p>
457454
<Translation id="page-developers-learning-tools:page-learning-tools-sandbox-desc" />
458-
</Text>
455+
</p>
459456
<LearningToolsCardGrid category={randomizedSandboxes} />
460457
<InfoBanner emoji=":point_up:" shouldCenter>
461458
<Translation id="page-developers-learning-tools:page-learning-tools-remix-description-2" />
@@ -465,18 +462,18 @@ const LearningToolsPage = () => {
465462
<SubtitleTwo>
466463
<Translation id="page-developers-learning-tools:page-learning-tools-game-tutorials" />
467464
</SubtitleTwo>
468-
<Text>
465+
<p>
469466
<Translation id="page-developers-learning-tools:page-learning-tools-game-tutorials-desc" />
470-
</Text>
467+
</p>
471468
<LearningToolsCardGrid category={games} />
472469
</StackContainer>
473470
<StackContainer>
474471
<SubtitleTwo>
475472
<Translation id="page-developers-learning-tools:page-learning-tools-bootcamps" />
476473
</SubtitleTwo>
477-
<Text>
474+
<p>
478475
<Translation id="page-developers-learning-tools:page-learning-tools-bootcamps-desc" />
479-
</Text>
476+
</p>
480477
<LearningToolsCardGrid category={bootcamps} />
481478
</StackContainer>
482479
<ContentBox>
@@ -493,13 +490,14 @@ const LearningToolsPage = () => {
493490
"page-developers-learning-tools:page-learning-tools-documentation-desc"
494491
}
495492
>
496-
<Box>
493+
<div>
497494
<ButtonLink href="/developers/docs/">
498495
<Translation id="page-developers-learning-tools:page-learning-tools-browse-docs" />
499496
</ButtonLink>
500-
</Box>
497+
</div>
501498
</CalloutBanner>
502499
</ContentBox>
500+
503501
<ContentBox>
504502
<FeedbackCard />
505503
</ContentBox>

tailwind.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const config = {
1919
heading: "var(--font-inter)",
2020
body: "var(--font-inter)",
2121
monospace: "var(--font-mono)",
22+
mono: "var(--font-mono)",
2223
},
2324
fontSize: {
2425
"7xl": ["4rem", "1.1"], // [7xl, 6xs]

0 commit comments

Comments
 (0)