Files
twenty_crm/front/src/modules/workspace/components/WorkspaceMemberCard.tsx
Jérémy M 872ec9e6bb feat: disable atomic operation on nestjs graphql models (#751)
* feat: no atomic

* feat: update front not atomic operations

* feat: optional fields for person model & use proper gql type

* Fix bug display name

* Fix bug update user

* Fixed bug avatar URL

* Fixed display name on people cell

* Fix lint

* Fixed storybook display name

* Fix storybook requests

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2023-07-20 19:23:35 +00:00

62 lines
1.6 KiB
TypeScript

import styled from '@emotion/styled';
import { Avatar } from '@/users/components/Avatar';
import { User } from '~/generated/graphql';
const StyledContainer = styled.div`
background: ${({ theme }) => theme.background.secondary};
border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.spacing(2)};
display: flex;
flex-direction: row;
margin-bottom: ${({ theme }) => theme.spacing(0)};
margin-top: ${({ theme }) => theme.spacing(4)};
padding: ${({ theme }) => theme.spacing(3)};
`;
const Content = styled.div`
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
margin-left: ${({ theme }) => theme.spacing(3)};
`;
const NameText = styled.span`
color: ${({ theme }) => theme.font.color.primary};
`;
const EmailText = styled.span`
color: ${({ theme }) => theme.font.color.tertiary};
`;
type OwnProps = {
workspaceMember: {
user: Pick<
User,
'id' | 'firstName' | 'lastName' | 'displayName' | 'avatarUrl' | 'email'
>;
};
accessory?: React.ReactNode;
};
export function WorkspaceMemberCard({ workspaceMember, accessory }: OwnProps) {
return (
<StyledContainer>
<Avatar
avatarUrl={workspaceMember.user.avatarUrl}
colorId={workspaceMember.user.id}
placeholder={workspaceMember.user.firstName || ''}
type="squared"
size={40}
/>
<Content>
<NameText>{workspaceMember.user.displayName}</NameText>
<EmailText>{workspaceMember.user.email}</EmailText>
</Content>
{accessory}
</StyledContainer>
);
}