2023-03-14 11:44:48 -07:00
|
|
|
import clsx from 'clsx';
|
|
|
|
import React from 'react';
|
|
|
|
|
2023-03-20 05:53:38 -07:00
|
|
|
import { GroupRoles } from 'soapbox/schemas/group-member';
|
2023-03-14 11:44:48 -07:00
|
|
|
|
|
|
|
import { Avatar } from '../ui';
|
|
|
|
|
|
|
|
import type { Group } from 'soapbox/schemas';
|
|
|
|
|
|
|
|
interface IGroupAvatar {
|
|
|
|
group: Group
|
|
|
|
size: number
|
|
|
|
withRing?: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
const GroupAvatar = (props: IGroupAvatar) => {
|
|
|
|
const { group, size, withRing = false } = props;
|
|
|
|
|
2023-03-20 05:53:38 -07:00
|
|
|
const isOwner = group.relationship?.role === GroupRoles.OWNER;
|
2023-03-14 11:44:48 -07:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Avatar
|
|
|
|
className={
|
|
|
|
clsx('relative rounded-full', {
|
2023-03-20 05:53:38 -07:00
|
|
|
'shadow-[0_0_0_2px_theme(colors.primary.600),0_0_0_4px_theme(colors.white)]': isOwner && withRing,
|
2023-03-30 12:19:14 -07:00
|
|
|
'dark:shadow-[0_0_0_2px_theme(colors.primary.600),0_0_0_4px_theme(colors.gray.800)]': isOwner && withRing,
|
2023-03-20 05:53:38 -07:00
|
|
|
'shadow-[0_0_0_2px_theme(colors.primary.600)]': isOwner && !withRing,
|
2023-03-30 12:19:14 -07:00
|
|
|
'shadow-[0_0_0_2px_theme(colors.white)] dark:shadow-[0_0_0_2px_theme(colors.gray.800)]': !isOwner && withRing,
|
2023-03-14 11:44:48 -07:00
|
|
|
})
|
|
|
|
}
|
|
|
|
src={group.avatar}
|
|
|
|
size={size}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default GroupAvatar;
|