feat: create NewsAuthor component and update news detail page

This commit is contained in:
fredy.siswanto
2025-03-08 21:29:39 +07:00
parent 06608c7b5d
commit 0b6327e2fb
4 changed files with 42 additions and 47 deletions
-22
View File
@@ -1,22 +0,0 @@
import type { JSX, SVGProps } from 'react'
export const LinkIcon = (
properties: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>,
) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width={95}
height={95}
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 1024 1024"
{...properties}
>
<path d="M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"></path>
</svg>
)
}
+34
View File
@@ -0,0 +1,34 @@
import type { TAuthor } from '~/apis/admin/get-news'
import { ProfileIcon } from '~/components/icons/profile'
import { formatDate } from '~/utils/formatter'
type TDetailNewsAuthor = {
author?: TAuthor
live_at?: string
text?: string
}
export const NewsAuthor = ({ author, live_at, text }: TDetailNewsAuthor) => {
return (
<div className="mb-2 flex items-center gap-2 align-middle">
{author?.profile_picture ? (
<img
src={author?.profile_picture}
alt={author?.name}
className="h-12 w-12 rounded-full bg-[#C4C4C4] object-cover"
/>
) : (
<ProfileIcon className="h-12 w-12 rounded-full bg-[#C4C4C4]" />
)}
<div>
<h4 className="text-md">{author?.name}</h4>
<p className="flex gap-1 text-sm">
<span>{live_at && `${formatDate(live_at)}`}</span>
<span>·</span>
<span>{text}</span>
</p>
</div>
</div>
)
}