refactor: enforce account page view model boundary
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Avatar } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
|
||||
export function PositionLogo({
|
||||
src,
|
||||
label,
|
||||
}: {
|
||||
src: string | null;
|
||||
label: string;
|
||||
}) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
if (src && !failed)
|
||||
return (
|
||||
<Avatar
|
||||
src={src}
|
||||
alt={label}
|
||||
size={40}
|
||||
radius="md"
|
||||
onError={() => setFailed(true)}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<Avatar size={40} radius="md">
|
||||
{(label.trim()[0] ?? "?").toUpperCase()}
|
||||
</Avatar>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user