forked from shadcn-ui/taxonomy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: implement blog and doc sites * fix: opacity for disabled menu items
- Loading branch information
Showing
101 changed files
with
5,280 additions
and
949 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -37,3 +37,4 @@ yarn-error.log* | |
next-env.d.ts | ||
|
||
.vscode | ||
.contentlayer |
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,9 +1,7 @@ | ||
import "styles/globals.css" | ||
|
||
interface AuthLayoutProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export default function RootLayout({ children }: AuthLayoutProps) { | ||
export default function AuthLayout({ children }: AuthLayoutProps) { | ||
return <div className="min-h-screen">{children}</div> | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import MdxHead from "@/components/docs/mdx-head" | ||
|
||
export default function Head({ params }) { | ||
return <MdxHead params={params} /> | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { notFound } from "next/navigation" | ||
import { allDocs } from "contentlayer/generated" | ||
|
||
import { getTableOfContents } from "@/lib/toc" | ||
import { Mdx } from "@/components/docs/mdx" | ||
import { DashboardTableOfContents } from "@/components/docs/toc" | ||
import { DocsPageHeader } from "@/components/docs/page-header" | ||
import { DocsPager } from "@/components/docs/pager" | ||
import "@/styles/mdx.css" | ||
|
||
interface DocPageProps { | ||
params: { | ||
slug: string[] | ||
} | ||
} | ||
|
||
export async function generateStaticParams(): Promise< | ||
DocPageProps["params"][] | ||
> { | ||
return allDocs.map((doc) => ({ | ||
slug: doc.slugAsParams.split("/"), | ||
})) | ||
} | ||
|
||
export default async function DocPage({ params }: DocPageProps) { | ||
const slug = params?.slug?.join("/") || "" | ||
const doc = allDocs.find((doc) => doc.slugAsParams === slug) | ||
|
||
if (!doc) { | ||
notFound() | ||
} | ||
|
||
const toc = await getTableOfContents(doc.body.raw) | ||
|
||
return ( | ||
<main className="relative py-6 lg:gap-10 lg:py-10 xl:grid xl:grid-cols-[1fr_300px]"> | ||
<div className="mx-auto w-full min-w-0"> | ||
<DocsPageHeader heading={doc.title} text={doc.description} /> | ||
<Mdx code={doc.body.code} /> | ||
<hr className="my-4 border-slate-200 md:my-6" /> | ||
<DocsPager doc={doc} /> | ||
</div> | ||
<div className="hidden text-sm xl:block"> | ||
<div className="sticky top-16 -mt-10 max-h-[calc(var(--vh)-4rem)] overflow-y-auto pt-10"> | ||
<DashboardTableOfContents toc={toc} /> | ||
</div> | ||
</div> | ||
</main> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { docsConfig } from "@/config/docs" | ||
import { DocsSidebarNav } from "@/components/docs/sidebar-nav" | ||
|
||
interface DocsLayoutProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export default function DocsLayout({ children }: DocsLayoutProps) { | ||
return ( | ||
<div className="flex-1 md:grid md:grid-cols-[220px_1fr] md:gap-6 lg:grid-cols-[240px_1fr] lg:gap-10"> | ||
<aside className="fixed top-14 z-30 hidden h-[calc(100vh-3.5rem)] w-full flex-shrink-0 overflow-y-auto border-r border-r-slate-100 py-6 pr-2 md:sticky md:block lg:py-10"> | ||
<DocsSidebarNav items={docsConfig.sidebarNav} /> | ||
</aside> | ||
{children} | ||
</div> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import MdxHead from "@/components/docs/mdx-head" | ||
|
||
export default function Head({ params }) { | ||
return <MdxHead params={params} /> | ||
} |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import Link from "next/link" | ||
import { notFound } from "next/navigation" | ||
|
||
import { allGuides } from "contentlayer/generated" | ||
|
||
import { getTableOfContents } from "@/lib/toc" | ||
import { Mdx } from "@/components/docs/mdx" | ||
import { DashboardTableOfContents } from "@/components/docs/toc" | ||
import { DocsPageHeader } from "@/components/docs/page-header" | ||
import { Icons } from "@/components/icons" | ||
import "@/styles/mdx.css" | ||
|
||
interface GuidePageProps { | ||
params: { | ||
slug: string[] | ||
} | ||
} | ||
|
||
export async function generateStaticParams(): Promise< | ||
GuidePageProps["params"][] | ||
> { | ||
return allGuides.map((guide) => ({ | ||
slug: guide.slugAsParams.split("/"), | ||
})) | ||
} | ||
|
||
export default async function GuidePage({ params }: GuidePageProps) { | ||
const slug = params?.slug?.join("/") | ||
const guide = allGuides.find((guide) => guide.slugAsParams === slug) | ||
|
||
if (!guide) { | ||
notFound() | ||
} | ||
|
||
const toc = await getTableOfContents(guide.body.raw) | ||
|
||
return ( | ||
<main className="relative py-6 lg:grid lg:grid-cols-[1fr_300px] lg:gap-10 lg:py-10 xl:gap-20"> | ||
<div> | ||
<DocsPageHeader heading={guide.title} text={guide.description} /> | ||
<Mdx code={guide.body.code} /> | ||
<hr className="my-4 border-slate-200" /> | ||
<div className="flex justify-center py-6 lg:py-10"> | ||
<Link | ||
href="/guides" | ||
className="mb-4 inline-flex items-center justify-center text-sm font-medium text-slate-600 hover:text-slate-900" | ||
> | ||
<Icons.chevronLeft className="mr-2 h-4 w-4" /> | ||
See all guides | ||
</Link> | ||
</div> | ||
</div> | ||
<div className="hidden text-sm lg:block"> | ||
<div className="sticky top-16 -mt-10 max-h-[calc(var(--vh)-4rem)] overflow-y-auto pt-10"> | ||
<DashboardTableOfContents toc={toc} /> | ||
</div> | ||
</div> | ||
</main> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
interface GuidesLayoutProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export default function GuidesLayout({ children }: GuidesLayoutProps) { | ||
return <div className="mx-auto max-w-5xl">{children}</div> | ||
} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Link from "next/link" | ||
import { compareDesc } from "date-fns" | ||
import { allGuides } from "contentlayer/generated" | ||
|
||
import { DocsPageHeader } from "@/components/docs/page-header" | ||
import { formatDate } from "@/lib/utils" | ||
|
||
export default function GuidesPage() { | ||
const guides = allGuides | ||
.filter((guide) => guide.published) | ||
.sort((a, b) => { | ||
return compareDesc(new Date(a.date), new Date(b.date)) | ||
}) | ||
|
||
return ( | ||
<div className="py-6 lg:py-10"> | ||
<DocsPageHeader | ||
heading="Guides" | ||
text="This section includes end-to-end guides for developing Next.js 13 apps." | ||
/> | ||
{guides?.length ? ( | ||
<div className="grid gap-4 md:grid-cols-2 md:gap-6"> | ||
{guides.map((guide) => ( | ||
<article | ||
key={guide._id} | ||
className="group relative rounded-lg border border-slate-200 bg-white p-6 shadow-md transition-shadow hover:shadow-lg" | ||
> | ||
{guide.featured && ( | ||
<span className="absolute top-4 right-4 rounded-full bg-slate-100 px-3 py-1 text-xs font-medium"> | ||
Featured | ||
</span> | ||
)} | ||
<div className="flex flex-col justify-between space-y-4"> | ||
<div className="space-y-2"> | ||
<h2 className="text-xl font-medium tracking-tight text-slate-900"> | ||
{guide.title} | ||
</h2> | ||
{guide.description && ( | ||
<p className="text-slate-700">{guide.description}</p> | ||
)} | ||
</div> | ||
{guide.date && ( | ||
<p className="text-sm text-slate-600"> | ||
{formatDate(guide.date)} | ||
</p> | ||
)} | ||
</div> | ||
<Link href={guide.slug} className="absolute inset-0"> | ||
<span className="sr-only">View</span> | ||
</Link> | ||
</article> | ||
))} | ||
</div> | ||
) : ( | ||
<p>No guides published.</p> | ||
)} | ||
</div> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Link from "next/link" | ||
|
||
import { siteConfig } from "@/config/site" | ||
import { docsConfig } from "@/config/docs" | ||
import { Icons } from "@/components/icons" | ||
import { MainNav } from "@/components/main-nav" | ||
import { DocsSearch } from "@/components/docs/search" | ||
import { SiteFooter } from "@/components/site-footer" | ||
import { DocsSidebarNav } from "@/components/docs/sidebar-nav" | ||
|
||
interface DocsLayoutProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export default function DocsLayout({ children }: DocsLayoutProps) { | ||
return ( | ||
<div className="flex min-h-screen flex-col"> | ||
<header className="sticky top-0 z-40 w-full border-b border-b-slate-200 bg-white"> | ||
<div className="container flex h-16 items-center space-x-4 sm:justify-between sm:space-x-0"> | ||
<MainNav items={docsConfig.mainNav}> | ||
<DocsSidebarNav items={docsConfig.sidebarNav} /> | ||
</MainNav> | ||
<div className="flex flex-1 items-center space-x-4 sm:justify-end"> | ||
<div className="flex-1 sm:flex-grow-0"> | ||
<DocsSearch /> | ||
</div> | ||
<nav className="flex space-x-4"> | ||
<Link | ||
href={siteConfig.links.github} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
<div className="flex h-7 w-7 items-center justify-center rounded-full bg-slate-900 text-slate-50 hover:bg-slate-600"> | ||
<Icons.gitHub className="h-4 w-4 fill-white" /> | ||
<span className="sr-only">GitHub</span> | ||
</div> | ||
</Link> | ||
</nav> | ||
</div> | ||
</div> | ||
</header> | ||
<div className="container flex-1">{children}</div> | ||
<SiteFooter /> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.