mirror of
https://gitlab.massbug.com/massbug/judge4c.git
synced 2025-07-04 09:31:13 +00:00
feat(workspaces): add WorkspaceAvatar component for displaying workspace images
This commit is contained in:
parent
5304524d75
commit
bdd852ccc6
33
src/features/workspaces/components/workspace-avatar.tsx
Normal file
33
src/features/workspaces/components/workspace-avatar.tsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import Image from "next/image";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
||||||
|
|
||||||
|
interface WorkspaceAvatarProps {
|
||||||
|
image?: string;
|
||||||
|
name: string;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WorkspaceAvatar = ({
|
||||||
|
image,
|
||||||
|
name,
|
||||||
|
className,
|
||||||
|
}: WorkspaceAvatarProps) => {
|
||||||
|
if (image) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={cn("size-10 relative rounded-md overflow-hidden", className)}
|
||||||
|
>
|
||||||
|
<Image src={image} alt={name} fill className="object-cover" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Avatar className={cn("size-10 rounded-md", className)}>
|
||||||
|
<AvatarFallback className="border bg-background text-foreground font-semibold text-lg uppercase rounded-md">
|
||||||
|
{name[0]}
|
||||||
|
</AvatarFallback>
|
||||||
|
</Avatar>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user