refactor: replace hardcoded descriptions with a constant for consistency

This commit is contained in:
Ardeman
2025-03-02 12:37:19 +08:00
parent 3937cc673a
commit 20fa80370b
5 changed files with 25 additions and 12 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
import { DUMMY_DESCRIPTION } from '~/data/contents'
import type { TNews } from '~/types/news'
export const BERITA: TNews = {
title: 'BERITA',
description: 'Berita Terhangat hari ini',
type: 'grid',
description: DUMMY_DESCRIPTION,
items: [
{
title: 'Travelling as a way of self-discovery and progress',
+16 -1
View File
@@ -1,13 +1,28 @@
import { useLocation, useRouteLoaderData } from 'react-router'
import { Card } from '~/components/ui/card'
import { CategorySection } from '~/components/ui/category-section'
import { DUMMY_DESCRIPTION } from '~/data/contents'
import type { loader } from '~/routes/_layout'
import { BERITA } from './data'
export const NewsCategoriesPage = () => {
const { pathname } = useLocation()
const code = pathname.split('/')[2]
const loaderData = useRouteLoaderData<typeof loader>('routes/_layout')
const { name } =
loaderData?.categoriesData.find((item) => item.code === code) || {}
const { items } = BERITA
return (
<div className="relative">
<Card>
<CategorySection {...BERITA} />
<CategorySection
title={name || ''}
description={DUMMY_DESCRIPTION}
items={items}
/>
</Card>
</div>
)