2024-01-15 12:33:15 +00:00
|
|
|
import { Category } from '@/types/content-types'
|
|
|
|
import { getDb } from '@/utils/ContentDatabase'
|
|
|
|
import Link from 'next/link'
|
|
|
|
import { Breadcrumb } from './Breadcrumb'
|
|
|
|
import { Header } from './Header'
|
|
|
|
import { Sidebar } from './Sidebar'
|
|
|
|
|
|
|
|
export async function CategoryDocsPage({ category }: { category: Category }) {
|
|
|
|
const db = await getDb()
|
|
|
|
const section = await db.getSection(category.sectionId)
|
|
|
|
const sidebar = await db.getSidebarContentList({ sectionId: category.sectionId })
|
|
|
|
const articles = await db.getCategoryArticles(section.id, category.id)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2024-01-30 14:19:25 +00:00
|
|
|
<Header sectionId={section.id} />
|
2024-01-15 12:33:15 +00:00
|
|
|
<Sidebar {...sidebar} />
|
|
|
|
<main className={'article'}>
|
|
|
|
<div className="page-header">
|
|
|
|
<Breadcrumb section={section} category={category} />
|
|
|
|
<h1>{category.title}</h1>
|
|
|
|
</div>
|
|
|
|
{articles.length > 0 && (
|
|
|
|
<ul>
|
|
|
|
{articles.map((article) => (
|
2024-02-29 16:28:45 +00:00
|
|
|
<li key={article.id}>
|
|
|
|
<Link href={`/${section.id}/${category.id}/${article.id}`}>{article.title}</Link>
|
2024-01-30 14:19:25 +00:00
|
|
|
</li>
|
2024-01-15 12:33:15 +00:00
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
)}
|
|
|
|
</main>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|