Files
homarr/src/components/AppAvatar.tsx
2023-03-29 12:42:47 +02:00

28 lines
583 B
TypeScript

import { Avatar, DefaultMantineColor, useMantineTheme } from '@mantine/core';
export const AppAvatar = ({
iconUrl,
color,
}: {
iconUrl: string;
color?: DefaultMantineColor | undefined;
}) => {
const { colors, colorScheme } = useMantineTheme();
return (
<Avatar
data-testid="app-avatar"
src={iconUrl}
bg={colorScheme === 'dark' ? colors.gray[8] : colors.gray[2]}
size="sm"
radius="xl"
p={4}
styles={{
root: {
borderColor: color !== undefined ? colors[color] : undefined,
},
}}
/>
);
};