tldraw/apps/docs/components/ArticleNavLinks.tsx

33 lines
776 B
TypeScript
Raw Normal View History

2023-04-25 11:01:25 +00:00
import { ArticleLinks } from '@/types/content-types'
import Link from 'next/link'
import { Icon } from './Icon'
type ArticleNavLinksProps = {
links: ArticleLinks
}
export function ArticleNavLinks({ links: { prev, next } }: ArticleNavLinksProps) {
return (
<div className="article__links">
{prev && (
<Link
href={`/${prev.sectionId}/${prev.categoryId}/${prev.id}`}
className="article__links__link article__links__prev"
>
<Icon icon="arrow-left" />
<span>{prev.title}</span>
</Link>
)}
{next && (
<Link
href={`/${next.sectionId}/${next.categoryId}/${next.id}`}
className="article__links__link article__links__next"
>
<span>{next.title}</span>
<Icon icon="arrow-right" />
</Link>
)}
</div>
)
}