Skip to content

Commit 8727a39

Browse files
committed
migrate internal layout components to tw
1 parent 4c9aa8d commit 8727a39

File tree

3 files changed

+30
-121
lines changed

3 files changed

+30
-121
lines changed

src/layouts/md/Roadmap.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { SimpleGrid } from "@chakra-ui/react"
2-
31
import type { ChildOnlyProp } from "@/lib/types"
42
import type { MdPageContent, RoadmapFrontmatter } from "@/lib/interfaces"
53

@@ -14,7 +12,7 @@ import { ContentLayout } from "../ContentLayout"
1412
import RoadmapHubHeroImage from "@/public/images/heroes/roadmap-hub-hero.jpg"
1513

1614
const CardGrid = (props: ChildOnlyProp) => (
17-
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={8} {...props} />
15+
<div className="grid grid-cols-1 gap-8 md:grid-cols-2" {...props} />
1816
)
1917

2018
// Roadmap layout components

src/layouts/md/Staking.tsx

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { HTMLAttributes } from "react"
22
import { useTranslation } from "next-i18next"
3-
import { Box, type BoxProps, Grid, SimpleGrid, Text } from "@chakra-ui/react"
43

54
import type { ChildOnlyProp } from "@/lib/types"
65
import type { MdPageContent, StakingFrontmatter } from "@/lib/interfaces"
@@ -35,85 +34,28 @@ const Heading4 = (props: HTMLAttributes<HTMLHeadingElement>) => (
3534
<MdHeading4 className="font-semibold max-md:text-md" {...props} />
3635
)
3736

38-
const Paragraph = (props: ChildOnlyProp) => (
39-
<Text fontSize="md" mt={8} mb={4} color="text300" {...props} />
40-
)
41-
42-
const Pre = (props: ChildOnlyProp) => (
43-
<Text
44-
as="pre"
45-
maxW="full"
46-
overflowX="scroll"
47-
bgColor="preBackground"
48-
borderRadius="base"
49-
p={4}
50-
border="1px solid"
51-
borderColor="preBorder"
52-
whiteSpace="pre-wrap"
53-
{...props}
54-
/>
55-
)
56-
5737
export const InfoGrid = (props: ChildOnlyProp) => (
58-
<Grid
59-
templateColumns="repeat(auto-fill, minmax(min(100%, 340px), 1fr))"
60-
gap={8}
61-
sx={{
62-
"& > div": {
63-
h: "fit-content",
64-
m: 0,
65-
"&:hover": {
66-
transition: "0.1s",
67-
transform: "scale(1.01)",
68-
svg: {
69-
transition: "0.1s",
70-
transform: "scale(1.1)",
71-
},
72-
},
73-
},
74-
}}
38+
<div
39+
className="grid grid-cols-[repeat(auto-fill,_minmax(100%,_340px),_1fr)] gap-8"
7540
{...props}
7641
/>
7742
)
7843

7944
const CardGrid = (props: ChildOnlyProp) => (
80-
<SimpleGrid
81-
columns={{ base: 1, md: 3 }}
82-
spacing={8}
83-
m={{ base: "auto", md: 0 }}
84-
sx={{
85-
h3: {
86-
mt: 0,
87-
},
88-
}}
45+
<div
46+
className="m-auto grid grid-cols-1 gap-8 md:m-0 md:grid-cols-3 [&_h3]:mt-0"
8947
{...props}
9048
/>
9149
)
9250

93-
const TableContainer = (props: BoxProps) => (
94-
<Box
95-
w="fit-content"
96-
mx={["auto", null, null, 0]}
97-
sx={{
98-
table: {
99-
borderCollapse: "separate",
100-
borderSpacing: "1rem 0",
101-
},
102-
th: {
103-
whiteSpace: "break-spaces !important",
104-
textAlign: "center",
105-
},
106-
}}
107-
{...props}
108-
/>
51+
const TableContainer = (props: ChildOnlyProp) => (
52+
<div className="mx-auto w-fit lg:mx-0" {...props} />
10953
)
11054

11155
// Staking layout components
11256
export const stakingComponents = {
11357
h1: Heading1,
11458
h4: Heading4,
115-
p: Paragraph,
116-
pre: Pre,
11759
CardGrid,
11860
DocLink,
11961
InfoGrid,

src/layouts/md/Translatathon.tsx

Lines changed: 23 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import { Box, Flex, Grid, Text } from "@chakra-ui/react"
2-
31
import type { ChildOnlyProp } from "@/lib/types"
42
import type { MdPageContent, SharedFrontmatter } from "@/lib/interfaces"
53

64
import { List as ButtonDropdownList } from "@/components/ButtonDropdown"
75
import Card from "@/components/Card"
86
import { ContentHero, ContentHeroProps } from "@/components/Hero"
9-
import { Image } from "@/components/Image"
7+
import { TwImage as Image } from "@/components/Image"
108
import { ApplyNow } from "@/components/Translatathon/ApplyNow"
119
import { APPLICATION_URL } from "@/components/Translatathon/constants"
1210
import { DatesAndTimeline } from "@/components/Translatathon/DatesAndTimeline"
@@ -16,6 +14,7 @@ import { TranslatathonCalendar } from "@/components/Translatathon/TranslatathonC
1614
import { TranslatathonInANutshell } from "@/components/Translatathon/TranslatathonInANutshell"
1715
import TranslatathonPrizes from "@/components/Translatathon/TranslatathonPrizes"
1816
import { TranslationHubCallout } from "@/components/Translatathon/TranslationHubCallout"
17+
import { Flex } from "@/components/ui/flex"
1918

2019
import { ContentLayout } from "../ContentLayout"
2120

@@ -25,80 +24,50 @@ import robotImage from "@/public/images/wallet.png"
2524

2625
const ContentSplit = ({ children }) => {
2726
return (
28-
<Flex w="full" direction={{ base: "column", md: "row" }}>
29-
<Box>{children}</Box>
30-
<Flex maxHeight="300px">
31-
<Image src={robotImage} alt="robot" style={{ objectFit: "contain" }} />
27+
<Flex className="w-full flex-col md:flex-row">
28+
<div>{children}</div>
29+
<Flex className="max-h-[300px]">
30+
<Image src={robotImage} alt="robot" className="object-contain" />
3231
</Flex>
3332
</Flex>
3433
)
3534
}
3635

3736
const TwoColumnContent = (props: ChildOnlyProp) => (
3837
<Flex
39-
w="full"
40-
direction={{ base: "column", md: "row" }}
41-
align="stretch"
42-
me={{ lg: 8 }}
43-
mt={8}
44-
gap={8}
38+
className="mt-8 w-full flex-col items-stretch gap-8 md:flex-row lg:me-8"
4539
{...props}
4640
/>
4741
)
4842

4943
const WhyWeDoItColumn = (props: ChildOnlyProp) => (
50-
<Flex
51-
w="full"
52-
m={{ base: "auto 0", lg: 0 }}
53-
me={{ lg: 8 }}
54-
direction="column"
55-
>
56-
<Box mx="auto" height="272">
57-
<Image src={WhyWeDoItImage} alt="" height="272" />
58-
</Box>
59-
<Box>{props.children}</Box>
44+
<Flex className="my-auto w-full flex-col lg:m-0 lg:me-8">
45+
<div className="mx-auto h-[272px]">
46+
<Image src={WhyWeDoItImage} alt="" className="h-[272px]" />
47+
</div>
48+
<div>{props.children}</div>
6049
</Flex>
6150
)
6251

6352
const HowDoesItWorkColumn = (props: ChildOnlyProp) => (
64-
<Flex
65-
w="full"
66-
m={{ base: "auto 0", lg: 0 }}
67-
ms={{ lg: 8 }}
68-
direction="column"
69-
>
70-
<Box mx="auto" height="272">
71-
<Image src={HowDoesItWorkImage} alt="" maxHeight="272" />
72-
</Box>
73-
<Box>{props.children}</Box>
53+
<Flex className="my-auto w-full flex-col lg:m-0 lg:ms-8">
54+
<div className="mx-auto h-[272px]">
55+
<Image src={HowDoesItWorkImage} alt="" className="h-[272px]" />
56+
</div>
57+
<div>{props.children}</div>
7458
</Flex>
7559
)
7660

7761
const CardContent = (props: ChildOnlyProp) => (
78-
<Flex
79-
w="full"
80-
m={{ base: "auto 0", lg: 0 }}
81-
borderRadius={4}
82-
border="1px solid"
83-
borderColor="body.light"
84-
direction="column"
85-
px={8}
86-
pb={8}
87-
flex="1"
88-
>
62+
<Flex className="my-auto w-full flex-1 flex-col rounded border border-body-light px-8 pb-8 lg:m-0">
8963
{props.children}
9064
</Flex>
9165
)
9266

9367
const CardContainer = (props: ChildOnlyProp) => (
94-
<Grid
95-
templateColumns="repeat(auto-fill, minmax(min(100%, 280px), 1fr))"
96-
gap={8}
97-
mb={20}
98-
mt={{ base: 8, lg: 0 }}
99-
>
68+
<div className="mb-20 mt-8 grid grid-cols-[repeat(auto-fill,_minmax(100%,_280px),_1fr)] gap-8 lg:mt-0">
10069
{props.children}
101-
</Grid>
70+
</div>
10271
)
10372

10473
const EmojiCard = ({ emoji, title, description }) => (
@@ -192,12 +161,12 @@ export const TranslatathonLayout = ({
192161
blurDataURL: "",
193162
description: (
194163
<>
195-
<Text>Welcome to the ethereum.org Translatathon!</Text>
196-
<Text>
164+
<p>Welcome to the ethereum.org Translatathon!</p>
165+
<p>
197166
The translatathon is a competitive hackathon-style event where you can
198167
compete for prizes by translating ethereum.org content into different
199168
languages.
200-
</Text>
169+
</p>
201170
</>
202171
),
203172
buttons: [

0 commit comments

Comments
 (0)