2024-01-15 12:33:15 +00:00
|
|
|
import { Article } from '@/types/content-types'
|
|
|
|
import { getDb } from '@/utils/ContentDatabase'
|
2024-01-17 10:10:44 +00:00
|
|
|
import { ArticleDetails } from './ArticleDetails'
|
2024-01-15 12:33:15 +00:00
|
|
|
import { ArticleNavLinks } from './ArticleNavLinks'
|
|
|
|
import { Breadcrumb } from './Breadcrumb'
|
|
|
|
import { Header } from './Header'
|
|
|
|
import { Mdx } from './Mdx'
|
|
|
|
import { Sidebar } from './Sidebar'
|
|
|
|
import { Image } from './mdx-components/generic'
|
|
|
|
|
|
|
|
export async function ArticleDocsPage({ article }: { article: Article }) {
|
|
|
|
const db = await getDb()
|
|
|
|
const section = await db.getSection(article.sectionId)
|
|
|
|
const category = await db.getCategory(article.categoryId)
|
|
|
|
const headings = await db.getArticleHeadings(article.id)
|
|
|
|
const links = await db.getArticleLinks(article)
|
|
|
|
const sidebar = await db.getSidebarContentList({
|
|
|
|
sectionId: section.id,
|
|
|
|
categoryId: category.id,
|
|
|
|
articleId: article.id,
|
|
|
|
})
|
|
|
|
|
2024-01-30 14:19:25 +00:00
|
|
|
const isGenerated = article.sectionId === 'reference'
|
2024-01-17 10:10:44 +00:00
|
|
|
|
2024-01-15 12:33:15 +00:00
|
|
|
return (
|
|
|
|
<>
|
2024-01-30 14:19:25 +00:00
|
|
|
<Header sectionId={section.id} />
|
|
|
|
<Sidebar headings={headings} {...sidebar} />
|
2024-02-05 14:42:55 +00:00
|
|
|
<main className={`article${isGenerated ? ' article__api-docs' : ''}`}>
|
2024-01-15 12:33:15 +00:00
|
|
|
<div className="page-header">
|
|
|
|
<Breadcrumb section={section} category={category} />
|
|
|
|
<h1>{article.title}</h1>
|
|
|
|
</div>
|
|
|
|
{article.hero && <Image alt="hero" title={article.title} src={`images/${article.hero}`} />}
|
|
|
|
{article.content && <Mdx content={article.content} />}
|
2024-01-17 10:10:44 +00:00
|
|
|
{isGenerated ? null : <ArticleDetails article={article} />}
|
2024-01-15 12:33:15 +00:00
|
|
|
{links && <ArticleNavLinks links={links} />}
|
|
|
|
</main>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|