Skip to content

Commit 7436407

Browse files
authored
Merge pull request #13588 from TylerAPfledderer/refactor/shadcn-static-layout
[ShadCN] refactor(layout/static): convert layout to ShadCN
2 parents 1c1ca79 + 50ade13 commit 7436407

File tree

1 file changed

+16
-33
lines changed

1 file changed

+16
-33
lines changed

src/layouts/Static.tsx

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useRouter } from "next/router"
2-
import { Box, Flex, type HeadingProps, Icon } from "@chakra-ui/react"
2+
import { type HeadingProps } from "@chakra-ui/react"
33

44
import type { ChildOnlyProp, Lang } from "@/lib/types"
55
import type { MdPageContent, StaticFrontmatter } from "@/lib/interfaces"
@@ -14,7 +14,6 @@ import GlossaryDefinition from "@/components/Glossary/GlossaryDefinition"
1414
import GlossaryTooltip from "@/components/Glossary/GlossaryTooltip"
1515
import { HubHero } from "@/components/Hero"
1616
import NetworkUpgradeSummary from "@/components/History/NetworkUpgradeSummary"
17-
import Link from "@/components/Link"
1817
import Logo from "@/components/Logo"
1918
import MainArticle from "@/components/MainArticle"
2019
import MatomoOptOut from "@/components/MatomoOptOut"
@@ -25,12 +24,13 @@ import {
2524
Heading4 as MdHeading4,
2625
} from "@/components/MdComponents"
2726
import MeetupList from "@/components/MeetupList"
28-
import Text from "@/components/OldText"
2927
import SocialListItem from "@/components/SocialListItem"
3028
import TableOfContents from "@/components/TableOfContents"
3129
import { TranslatathonBanner } from "@/components/Translatathon/TranslatathonBanner"
3230
import Translation from "@/components/Translation"
3331
import TranslationChartImage from "@/components/TranslationChartImage"
32+
import { Flex, Stack } from "@/components/ui/flex"
33+
import Link from "@/components/ui/Link"
3434
import UpcomingEventsList from "@/components/UpcomingEventsList"
3535

3636
import { getEditPath } from "@/lib/utils/editPath"
@@ -62,7 +62,6 @@ export const staticComponents = {
6262
EnergyConsumptionChart,
6363
GlossaryDefinition,
6464
GlossaryTooltip,
65-
Icon,
6665
Link,
6766
Logo,
6867
MatomoOptOut,
@@ -93,19 +92,14 @@ export const StaticLayout = ({
9392
const absoluteEditPath = getEditPath(slug)
9493

9594
return (
96-
<Box w="full">
95+
<div className="w-full">
9796
<TranslatathonBanner pathname={asPath} />
9897
<DevconGrantsBanner pathname={asPath} />
9998
<Flex
100-
justifyContent="space-between"
101-
w="full"
102-
mx="auto"
103-
mb={16}
104-
p={8}
105-
pt={{ base: 8, lg: 16 }}
99+
className="mx-auto mb-16 w-full justify-between p-8 lg:pt-16"
106100
dir={contentNotTranslated ? "ltr" : "unset"}
107101
>
108-
<Box w="full">
102+
<div className="w-full">
109103
{slug === "/guides/" ? (
110104
<HubHero
111105
heroImg={GuideHeroImage}
@@ -114,31 +108,20 @@ export const StaticLayout = ({
114108
description={frontmatter.description}
115109
/>
116110
) : (
117-
<>
118-
<Breadcrumbs slug={slug} mb="8" />
111+
<Stack className="gap-8">
112+
<Breadcrumbs slug={slug} />
119113

120-
<Text
121-
color="text200"
114+
<p
115+
className="text-body-medium"
122116
dir={isLangRightToLeft(locale as Lang) ? "rtl" : "ltr"}
123117
>
124118
<Translation id="page-last-updated" />:{" "}
125119
{lastEditLocaleTimestamp}
126-
</Text>
127-
</>
120+
</p>
121+
</Stack>
128122
)}
129123

130-
<Box
131-
as={MainArticle}
132-
maxW="container.md"
133-
w="full"
134-
sx={{
135-
".citation": {
136-
p: {
137-
color: "text200",
138-
},
139-
},
140-
}}
141-
>
124+
<MainArticle className="max-w-3xl">
142125
<TableOfContents
143126
position="relative"
144127
zIndex={2}
@@ -150,15 +133,15 @@ export const StaticLayout = ({
150133
{children}
151134

152135
<FeedbackCard isArticle />
153-
</Box>
154-
</Box>
136+
</MainArticle>
137+
</div>
155138
<TableOfContents
156139
editPath={absoluteEditPath}
157140
items={tocItems}
158141
maxDepth={frontmatter.sidebarDepth || 2}
159142
hideEditButton={!!frontmatter.hideEditButton}
160143
/>
161144
</Flex>
162-
</Box>
145+
</div>
163146
)
164147
}

0 commit comments

Comments
 (0)