bigbuffet-rw/app/soapbox/components/groups/group-avatar.tsx

36 lines
886 B
TypeScript
Raw Normal View History

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,
'shadow-[0_0_0_2px_theme(colors.primary.600)]': isOwner && !withRing,
'shadow-[0_0_0_2px_theme(colors.white)]': !isOwner && withRing,
2023-03-14 11:44:48 -07:00
})
}
src={group.avatar}
size={size}
/>
);
};
export default GroupAvatar;