11import Link from "next/link"
2+ import { notFound } from "next/navigation"
23
3- import { TTagItem } from "database"
4+ import { getTag } from "database"
45import { Tag } from "lucide-react"
5- import { Button , Card , CardContent , CardHeader } from "ui"
6+ import { getTranslations } from "next-intl/server"
7+ import { Button , Card , CardContent , CardHeader , Typography } from "ui"
68
7- export type TagDetailProp = {
8- tag : TTagItem
9- }
9+ export default async function TagDetail ( { tagIdOrSlug } : { tagIdOrSlug : string } ) {
10+ const t = await getTranslations ( )
11+
12+ const { data : tag , error } = await getTag ( {
13+ tagIdOrSlug,
14+ } )
15+
16+ if ( error ) {
17+ return notFound ( )
18+ }
1019
11- const TagDetail = ( { tag } : TagDetailProp ) => {
1220 return (
1321 < div className = "col-span-4" >
1422 < Card >
@@ -19,9 +27,9 @@ const TagDetail = ({ tag }: TagDetailProp) => {
1927 </ CardHeader >
2028 < CardContent >
2129 < div className = "flex flex-col items-center justify-center gap-2" >
22- < h1 className = "flex-1 text-center text-4xl font-extrabold text-slate-700 ">
30+ < Typography variant = "h1 ">
2331 < Link href = { `/tags/${ tag ?. slug || tag ?. id } ` } > { tag . name } </ Link >
24- </ h1 >
32+ </ Typography >
2533 < div className = "mt-4 flex w-full flex-1 divide-x" >
2634 < div className = "flex flex-1 flex-col items-center justify-center" >
2735 < div className = "font-bold text-slate-800" > { tag ?. _count ?. tagOnPost || 0 } </ div >
@@ -40,13 +48,11 @@ const TagDetail = ({ tag }: TagDetailProp) => {
4048 className = "mt-4 w-full"
4149 variant = "outline"
4250 >
43- Follow
51+ { t ( "common.follow" ) }
4452 </ Button >
4553 </ div >
4654 </ CardContent >
4755 </ Card >
4856 </ div >
4957 )
5058}
51-
52- export default TagDetail
0 commit comments