Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ShadCN] refactor(layout/static): convert layout to ShadCN #13588

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
)
}
Loading