refactor: remove ProfileIcon component and update image handling for author profiles

This commit is contained in:
Ardeman
2025-03-25 19:25:49 +08:00
parent 84451f1fd4
commit eedb155880
7 changed files with 42 additions and 48 deletions
+8 -10
View File
@@ -1,5 +1,4 @@
import type { TAuthorResponse } from '~/apis/common/get-news'
import { ProfileIcon } from '~/components/icons/profile'
import { formatDate } from '~/utils/formatter'
type TDetailNewsAuthor = {
@@ -11,15 +10,14 @@ type TDetailNewsAuthor = {
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="size-12 rounded-full bg-[#C4C4C4] object-cover"
/>
) : (
<ProfileIcon className="size-12 rounded-full bg-[#C4C4C4]" />
)}
<img
src={author?.profile_picture || '/images/profile-placeholder.svg'}
onError={(event) => {
event.currentTarget.src = '/images/profile-placeholder.svg'
}}
alt={author?.name}
className="size-12 rounded-full bg-[#C4C4C4] object-cover"
/>
<div>
<h4 className="text-md">{author?.name}</h4>