Refactor RecentFunds component to display only the first two characters of the deal name in the AvatarFallback

This commit is contained in:
Pattadon 2024-11-01 15:25:44 +07:00
parent 2188d2b33f
commit 475c6eb9c2

View File

@ -1,45 +1,7 @@
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
const data = [
{
name: "Olivia Martin",
email: "olivia.martin@email.com",
amount: "1900.00",
avatar: "/avatars/01.png", // psuedo avatar image
initials: "OM",
},
{
name: "Jackson Lee",
email: "jackson.lee@email.com",
amount: "39.00",
avatar: "/avatars/02.png",
initials: "JL",
},
{
name: "Isabella Nguyen",
email: "isabella.nguyen@email.com",
amount: "299.00",
avatar: "/avatars/03.png",
initials: "IN",
},
{
name: "William Kim",
email: "will@email.com",
amount: "99.00",
avatar: "/avatars/04.png",
initials: "WK",
},
{
name: "Sofia Davis",
email: "sofia.davis@email.com",
amount: "39.00",
avatar: "/avatars/05.png",
initials: "SD",
},
];
interface RecentFundsProps {
data?: { name?: string; amount?: number; avatar?: string ; date?: Date}[];
data?: { name?: string; amount?: number; avatar?: string; date?: Date }[];
}
export function RecentFunds(props: RecentFundsProps) {
return (
@ -52,7 +14,9 @@ export function RecentFunds(props: RecentFundsProps) {
</Avatar>
<div className="ml-4 space-y-1">
<p className="text-sm font-medium leading-none">{deal.name}</p>
<p className="text-xs text-muted-foreground">{deal?.date?.toLocaleDateString()}</p>
<p className="text-xs text-muted-foreground">
{deal?.date?.toLocaleDateString()}
</p>
</div>
<div className="ml-auto font-medium">+${deal.amount}</div>
</div>