refactor: enhance news handling and improve content display in various components

This commit is contained in:
Ardeman
2025-03-09 11:36:47 +08:00
parent bad5294030
commit 4847ef2be3
11 changed files with 161 additions and 26 deletions
+3 -5
View File
@@ -4,14 +4,12 @@ import { Card } from '~/components/ui/card'
import { CategorySection } from '~/components/ui/category-section'
import type { loader } from '~/routes/_news.category.$code'
import { BERITA } from './data'
export const NewsCategoriesPage = () => {
const loaderData = useRouteLoaderData<typeof loader>(
'routes/_news.category.$code',
)
const { name, description } = loaderData?.categoryData || {}
const { items } = BERITA
const { categoryData, newsData } = loaderData || {}
const { name, description } = categoryData || {}
return (
<div className="relative">
@@ -19,7 +17,7 @@ export const NewsCategoriesPage = () => {
<CategorySection
title={name || ''}
description={description || ''}
items={items}
items={newsData || []}
/>
</Card>
</div>