tldraw/apps/docs/components/Breadcrumb.tsx

41 lines
802 B
TypeScript
Raw Normal View History

2023-04-25 11:01:25 +00:00
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>
)
}