import htmlParse from 'html-react-parser' import { useRouteLoaderData } from 'react-router' import type { TTagResponse } from '~/apis/common/get-tags' import { ProfileIcon } from '~/components/icons/profile' import { Card } from '~/components/ui/card' import { CarouselSection } from '~/components/ui/carousel-section' import { IconsSocial } from '~/components/ui/social-share' import { BERITA } from '~/data/contents' import type { loader } from '~/routes/_news.detail.$slug' import { formatDate } from '~/utils/formatter' export const NewsDetailPage = () => { const loaderData = useRouteLoaderData( 'routes/_news.detail.$slug', ) const { newsDetailData } = loaderData || {} const { title, content, featured_image, slug, author, live_at, tags } = newsDetailData || {} return ( {title} {/* START TODO: create component for this section */} {author?.profile_picture ? ( ) : ( )} {author?.name} {live_at && `${formatDate(live_at)}`} ยท 5 min read {/* END TODO: create component for this section */} {content && htmlParse(content)} Share this post {tags?.map((tag: TTagResponse) => ( {tag.name} ))} ) }
{live_at && `${formatDate(live_at)}`} ยท 5 min read
Share this post