refactor: implement Tags component for improved tag display and update news types

This commit is contained in:
Ardeman
2025-03-09 11:56:57 +08:00
parent 1b6321f2bd
commit ee816b8db7
7 changed files with 57 additions and 183 deletions
+3 -11
View File
@@ -2,11 +2,11 @@ import htmlParse from 'html-react-parser'
import { useReadingTime } from 'react-hook-reading-time'
import { useRouteLoaderData } from 'react-router'
import type { TTagResponse } from '~/apis/common/get-tags'
import { Card } from '~/components/ui/card'
import { CarouselSection } from '~/components/ui/carousel-section'
import { NewsAuthor } from '~/components/ui/news-author'
import { SocialShareButtons } from '~/components/ui/social-share'
import { Tags } from '~/components/ui/tags'
import { BERITA } from '~/data/contents'
import type { loader } from '~/routes/_news.detail.$slug'
@@ -62,16 +62,8 @@ export const NewsDetailPage = () => {
title={`${title}`}
/>
</div>
<div className="my-3 flex gap-2 uppercase max-sm:text-sm">
{tags?.map((tag: TTagResponse) => (
<span
key={tag.id}
className="inline-block rounded bg-[#F4F4F4] px-3 py-1 font-bold text-[#777777]"
>
{tag.name}
</span>
))}
</div>
<Tags tags={tags || []} />
</div>
</div>
</Card>