mirror of
https://github.com/docmost/docmost.git
synced 2026-05-18 15:34:05 +08:00
33 lines
661 B
TypeScript
33 lines
661 B
TypeScript
import React from "react";
|
|
import { Avatar } from "@mantine/core";
|
|
import { getAvatarUrl } from "@/lib/config.ts";
|
|
|
|
interface CustomAvatarProps {
|
|
avatarUrl: string;
|
|
name: string;
|
|
color?: string;
|
|
size?: string | number;
|
|
radius?: string | number;
|
|
variant?: string;
|
|
style?: any;
|
|
component?: any;
|
|
}
|
|
|
|
export const CustomAvatar = React.forwardRef<
|
|
HTMLInputElement,
|
|
CustomAvatarProps
|
|
>(({ avatarUrl, name, ...props }: CustomAvatarProps, ref) => {
|
|
const avatarLink = getAvatarUrl(avatarUrl);
|
|
|
|
return (
|
|
<Avatar
|
|
ref={ref}
|
|
src={avatarLink}
|
|
name={name}
|
|
alt={name}
|
|
color="initials"
|
|
{...props}
|
|
/>
|
|
);
|
|
});
|