Skip to content

Commit 73eec15

Browse files
committed
refactor: LeftNavBar to ToC variant="left"
1 parent ba48445 commit 73eec15

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

app/[locale]/learn/page.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import FileContributors from "@/components/FileContributors"
1313
import { HubHero } from "@/components/Hero"
1414
import type { HubHeroProps } from "@/components/Hero/HubHero"
1515
import { Image, ImageProps } from "@/components/Image"
16-
import LeftNavBar from "@/components/LeftNavBar"
1716
import MainArticle from "@/components/MainArticle"
1817
import { ContentContainer } from "@/components/MdComponents"
18+
import TableOfContents from "@/components/TableOfContents"
1919
import { ButtonLink } from "@/components/ui/buttons/Button"
2020
import { Center, Flex, Stack } from "@/components/ui/flex"
2121
import InlineLink from "@/components/ui/Link"
@@ -185,11 +185,7 @@ export default async function Page({ params }: { params: Promise<Params> }) {
185185
asChild
186186
>
187187
<MainArticle>
188-
<LeftNavBar
189-
tocItems={tocData}
190-
// TODO: Remove `!` flag once this component is migrated to ShadCN
191-
className="max-lg:!hidden"
192-
/>
188+
<TableOfContents items={tocData} variant="left" />
193189

194190
<ContentContainer id="content">
195191
<Section

app/[locale]/staking/_components/staking.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import Card from "@/components/Card"
1313
import ExpandableCard from "@/components/ExpandableCard"
1414
import FeedbackCard from "@/components/FeedbackCard"
1515
import FileContributors from "@/components/FileContributors"
16-
import LeftNavBar from "@/components/LeftNavBar"
1716
import { ContentContainer, Page } from "@/components/MdComponents"
1817
import MobileButtonDropdown from "@/components/MobileButtonDropdown"
1918
import PageHero from "@/components/PageHero"
2019
import StakingCommunityCallout from "@/components/Staking/StakingCommunityCallout"
2120
import StakingHierarchy from "@/components/Staking/StakingHierarchy"
2221
import StakingStatsBox from "@/components/Staking/StakingStatsBox"
22+
import TableOfContents from "@/components/TableOfContents"
2323
import Translation from "@/components/Translation"
2424
import {
2525
ButtonLink,
@@ -251,11 +251,10 @@ const StakingPage = ({
251251
<StakingStatsBox data={data} />
252252
</HeroStatsWrapper>
253253
<Page>
254-
<LeftNavBar
254+
<TableOfContents
255+
items={tocArray}
256+
variant="left"
255257
dropdownLinks={dropdownLinks}
256-
tocItems={tocArray}
257-
// TODO: Remove bang after this component is migrated to Tailwind
258-
className="max-lg:!hidden"
259258
/>
260259
<ContentContainer>
261260
<Flex className="mt-16 flex-col gap-16 lg:mt-0">

src/layouts/ContentLayout.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ import { FileContributor } from "@/lib/types"
44

55
import FeedbackCard from "@/components/FeedbackCard"
66
import FileContributors from "@/components/FileContributors"
7-
import LeftNavBar, { LeftNavBarProps } from "@/components/LeftNavBar"
87
import { ContentContainer, Page } from "@/components/MdComponents"
98
import MobileButtonDropdown from "@/components/MobileButtonDropdown"
9+
import TableOfContents, {
10+
type TableOfContentsProps,
11+
} from "@/components/TableOfContents"
1012

1113
type ContentLayoutProps = HTMLAttributes<HTMLDivElement> &
12-
Pick<LeftNavBarProps, "dropdownLinks" | "tocItems" | "maxDepth"> & {
13-
showDropdown?: boolean
14+
Pick<TableOfContentsProps, "dropdownLinks" | "showDropdown" | "maxDepth"> & {
1415
children: React.ReactNode
16+
tocItems: TableOfContentsProps["items"]
1517
heroSection: React.ReactNode
1618
contributors: FileContributor[]
1719
lastEditLocaleTimestamp: string
@@ -33,14 +35,12 @@ export const ContentLayout = ({
3335
{heroSection}
3436

3537
<Page>
36-
<LeftNavBar
37-
className="max-lg:hidden"
38+
<TableOfContents
39+
items={tocItems}
3840
dropdownLinks={dropdownLinks}
39-
tocItems={tocItems}
4041
maxDepth={maxDepth}
4142
showDropdown={showDropdown}
4243
/>
43-
4444
<ContentContainer>
4545
{children}
4646

0 commit comments

Comments
 (0)