tldraw/apps/docs/components/Breadcrumb.tsx
2023-04-25 12:01:25 +01:00

40 lines
802 B
TypeScript

import { Article, Category, Section } from '@/types/content-types'
import Link from 'next/link'
export function Breadcrumb({
section,
category,
article,
}: {
section?: Section
category?: Category
article?: Article
}) {
return (
<div className="breadcrumb">
<Link href={`/`}>tldraw</Link>
{section && (
<>
{` / `}
<Link href={`/${section.id}`}>{section.title}</Link>
{category && (
<>
{category.id === 'ucg' ? null : (
<>
{` / `}
<Link href={`/${section.id}/${category.id}`}>{category.title}</Link>
</>
)}
{article && (
<>
{` / `}
<Link href={`/${section.id}/${category.id}/${article.id}`}>{article.title}</Link>
</>
)}
</>
)}
</>
)}
</div>
)
}