Skip to content

Commit

Permalink
Merge pull request #13588 from TylerAPfledderer/refactor/shadcn-stati…
Browse files Browse the repository at this point in the history
…c-layout

[ShadCN] refactor(layout/static): convert layout to ShadCN
  • Loading branch information
pettinarip authored Aug 21, 2024
2 parents 1c1ca79 + 50ade13 commit 7436407
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions src/layouts/Static.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRouter } from "next/router"
import { Box, Flex, type HeadingProps, Icon } from "@chakra-ui/react"
import { type HeadingProps } from "@chakra-ui/react"

import type { ChildOnlyProp, Lang } from "@/lib/types"
import type { MdPageContent, StaticFrontmatter } from "@/lib/interfaces"
Expand All @@ -14,7 +14,6 @@ import GlossaryDefinition from "@/components/Glossary/GlossaryDefinition"
import GlossaryTooltip from "@/components/Glossary/GlossaryTooltip"
import { HubHero } from "@/components/Hero"
import NetworkUpgradeSummary from "@/components/History/NetworkUpgradeSummary"
import Link from "@/components/Link"
import Logo from "@/components/Logo"
import MainArticle from "@/components/MainArticle"
import MatomoOptOut from "@/components/MatomoOptOut"
Expand All @@ -25,12 +24,13 @@ import {
Heading4 as MdHeading4,
} from "@/components/MdComponents"
import MeetupList from "@/components/MeetupList"
import Text from "@/components/OldText"
import SocialListItem from "@/components/SocialListItem"
import TableOfContents from "@/components/TableOfContents"
import { TranslatathonBanner } from "@/components/Translatathon/TranslatathonBanner"
import Translation from "@/components/Translation"
import TranslationChartImage from "@/components/TranslationChartImage"
import { Flex, Stack } from "@/components/ui/flex"
import Link from "@/components/ui/Link"
import UpcomingEventsList from "@/components/UpcomingEventsList"

import { getEditPath } from "@/lib/utils/editPath"
Expand Down Expand Up @@ -62,7 +62,6 @@ export const staticComponents = {
EnergyConsumptionChart,
GlossaryDefinition,
GlossaryTooltip,
Icon,
Link,
Logo,
MatomoOptOut,
Expand Down Expand Up @@ -93,19 +92,14 @@ export const StaticLayout = ({
const absoluteEditPath = getEditPath(slug)

return (
<Box w="full">
<div className="w-full">
<TranslatathonBanner pathname={asPath} />
<DevconGrantsBanner pathname={asPath} />
<Flex
justifyContent="space-between"
w="full"
mx="auto"
mb={16}
p={8}
pt={{ base: 8, lg: 16 }}
className="mx-auto mb-16 w-full justify-between p-8 lg:pt-16"
dir={contentNotTranslated ? "ltr" : "unset"}
>
<Box w="full">
<div className="w-full">
{slug === "/guides/" ? (
<HubHero
heroImg={GuideHeroImage}
Expand All @@ -114,31 +108,20 @@ export const StaticLayout = ({
description={frontmatter.description}
/>
) : (
<>
<Breadcrumbs slug={slug} mb="8" />
<Stack className="gap-8">
<Breadcrumbs slug={slug} />

<Text
color="text200"
<p
className="text-body-medium"
dir={isLangRightToLeft(locale as Lang) ? "rtl" : "ltr"}
>
<Translation id="page-last-updated" />:{" "}
{lastEditLocaleTimestamp}
</Text>
</>
</p>
</Stack>
)}

<Box
as={MainArticle}
maxW="container.md"
w="full"
sx={{
".citation": {
p: {
color: "text200",
},
},
}}
>
<MainArticle className="max-w-3xl">
<TableOfContents
position="relative"
zIndex={2}
Expand All @@ -150,15 +133,15 @@ export const StaticLayout = ({
{children}

<FeedbackCard isArticle />
</Box>
</Box>
</MainArticle>
</div>
<TableOfContents
editPath={absoluteEditPath}
items={tocItems}
maxDepth={frontmatter.sidebarDepth || 2}
hideEditButton={!!frontmatter.hideEditButton}
/>
</Flex>
</Box>
</div>
)
}

0 comments on commit 7436407

Please sign in to comment.