-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to the documentation site (#541)
- Loading branch information
Showing
80 changed files
with
2,974 additions
and
2,634 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,53 @@ | ||
import { allGettingStarteds } from "contentlayer/generated"; | ||
import { notFound } from "next/navigation"; | ||
|
||
import getSectionLinks from "@/app/lib/getSectionLinks.ts"; | ||
import Aside from "@/app/ui/layout/aside/Aside.tsx"; | ||
import { BasePageLayout } from "@/app/ui/layout/basePageLayout/BasePageLayout"; | ||
import Mdx from "@/components/mdx/Mdx.tsx"; | ||
import Title from "@/components/title/Title"; | ||
import { allGettingStarteds } from "contentlayer/generated"; | ||
import { notFound } from "next/navigation"; | ||
|
||
interface PageProps { | ||
params: { | ||
slug: string[]; | ||
}; | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return allGettingStarteds.map(({ section }) => ({ | ||
slug: [section] | ||
})); | ||
function findPageFromSlug(slug: string[]) { | ||
const [section, type] = slug; | ||
|
||
return allGettingStarteds.find(page => page.section === section && page.slug === type); | ||
} | ||
|
||
export default function IconPage({ params }: PageProps) { | ||
const [section, type] = params.slug; | ||
const pages = allGettingStarteds.find(page => page.slug === type && page.section === section); | ||
export default function GettingStartedPage({ params }: PageProps) { | ||
const page = findPageFromSlug(params.slug); | ||
|
||
if (!pages) { | ||
if (!page) { | ||
notFound(); | ||
} | ||
|
||
const sectionLinks = getSectionLinks(pages); | ||
const sectionLinks = getSectionLinks(page); | ||
const { title, body: { code }, _id: id } = page; | ||
|
||
return ( | ||
<div className="hd-container"> | ||
<Aside title="On this page" links={sectionLinks} /> | ||
<main> | ||
<article className="hd-content" key={pages._id}> | ||
<Title as="h1">{pages.title}</Title> | ||
<Mdx code={pages.body.code} /> | ||
</article> | ||
</main> | ||
</div> | ||
<BasePageLayout sectionsLinks={sectionLinks}> | ||
<article className="hd-content" key={id}> | ||
<Title level={1}>{title}</Title> | ||
<Mdx code={code} /> | ||
</article> | ||
</BasePageLayout> | ||
); | ||
} | ||
|
||
|
||
export async function generateStaticParams() { | ||
return allGettingStarteds.map(({ section, slug }) => ({ | ||
slug: [section, slug] | ||
})); | ||
} | ||
|
||
export async function generateMetadata({ params }: PageProps) { | ||
const page = await findPageFromSlug(params.slug); | ||
|
||
return { | ||
title: page ? `${page.title}` : null | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,16 @@ | ||
"use client"; | ||
|
||
import getPageLinks from "@/app/lib/getPageLinks"; | ||
import getSectionLinks from "@/app/lib/getSectionLinks"; | ||
import Sidebar from "@/app/ui/layout/sidebar/Sidebar"; | ||
import SubHeader from "@/app/ui/layout/subHeader/SubHeader"; | ||
import Wrapper from "@/app/ui/layout/wrapper/Wrapper"; | ||
import { SidebarProvider } from "@/context/sidebar/SidebarProvider"; | ||
import { SidebarLayout } from "@/app/ui/layout/sidebarLayout"; | ||
import { allGettingStarteds } from "contentlayer/generated"; | ||
import { notFound, useSelectedLayoutSegment } from "next/navigation"; | ||
import type { ReactNode } from "react"; | ||
|
||
export default function GettingStartedLayout({ children }: { children: ReactNode }) { | ||
const selectedLayoutSegment = useSelectedLayoutSegment(); | ||
const [section, type] = selectedLayoutSegment?.split("/") ?? ["", ""]; | ||
|
||
const pageContent = allGettingStarteds.find(page => page.slug === type && page.section === section); | ||
if (!pageContent) { | ||
return notFound(); | ||
} | ||
|
||
const sectionLinks = getSectionLinks(pageContent); | ||
const allGettingStartedsLinks = getPageLinks(allGettingStarteds, { | ||
const allGettingStartedLinks = getPageLinks(allGettingStarteds, { | ||
order: ["overview", "installation-path", "advanced-options", "guides"] | ||
}); | ||
|
||
return ( | ||
<SidebarProvider> | ||
<SubHeader links={sectionLinks} /> | ||
<Wrapper type="with-sidebar"> | ||
<Sidebar links={allGettingStartedsLinks} /> | ||
{children} | ||
</Wrapper> | ||
</SidebarProvider> | ||
<SidebarLayout links={allGettingStartedLinks}> | ||
{children} | ||
</SidebarLayout> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.