significant refactor
This commit is contained in:
@@ -1,18 +1,43 @@
|
||||
import { Avatar as MantineAvatar, AvatarProps as MantineAvatarProps, Paper } from '@mantine/core';
|
||||
import {
|
||||
Avatar as MantineAvatar,
|
||||
AvatarProps as MantineAvatarProps,
|
||||
Paper,
|
||||
} from "@mantine/core";
|
||||
|
||||
interface AvatarProps extends Omit<MantineAvatarProps, 'radius' | 'color' | 'size'> {
|
||||
interface AvatarProps
|
||||
extends Omit<MantineAvatarProps, "radius" | "color" | "size"> {
|
||||
name: string;
|
||||
size?: number;
|
||||
radius?: string | number;
|
||||
withBorder?: boolean;
|
||||
}
|
||||
|
||||
const Avatar = ({ name, size = 35, radius = '100%', withBorder = true, ...props }: AvatarProps) => {
|
||||
return <Paper p={size / 20} radius={radius} withBorder={withBorder}>
|
||||
<MantineAvatar alt={name} key={name} name={name} color='initials' size={size} radius={radius} w='fit-content' styles={{ image: {
|
||||
objectFit: 'contain'
|
||||
} }} {...props} />
|
||||
</Paper>
|
||||
}
|
||||
const Avatar = ({
|
||||
name,
|
||||
size = 35,
|
||||
radius = "100%",
|
||||
withBorder = true,
|
||||
...props
|
||||
}: AvatarProps) => {
|
||||
return (
|
||||
<Paper p={size / 20} radius={radius} withBorder={withBorder}>
|
||||
<MantineAvatar
|
||||
alt={name}
|
||||
key={name}
|
||||
name={name}
|
||||
color="initials"
|
||||
size={size}
|
||||
radius={radius}
|
||||
w="fit-content"
|
||||
styles={{
|
||||
image: {
|
||||
objectFit: "contain",
|
||||
},
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
|
||||
export default Avatar;
|
||||
|
||||
Reference in New Issue
Block a user