Files
twenty_crm/front/src/modules/companies/components/CompanyChip.tsx
Lucas Bordeau d28a762661 Finished relation picker for companies (#305)
* Finished relation picker for companies

* Minor fixes
2023-06-15 16:53:59 +02:00

51 lines
1.1 KiB
TypeScript

import styled from '@emotion/styled';
import { Avatar } from '@/users/components/Avatar';
export type CompanyChipPropsType = {
name: string;
picture?: string;
};
const StyledContainer = styled.span`
align-items: center;
background-color: ${(props) => props.theme.tertiaryBackground};
border-radius: ${(props) => props.theme.spacing(1)};
color: ${(props) => props.theme.text80};
display: inline-flex;
gap: ${(props) => props.theme.spacing(1)};
height: calc(20px - 2 * ${(props) => props.theme.spacing(1)});
padding: ${(props) => props.theme.spacing(1)};
user-select: none;
:hover {
filter: brightness(95%);
}
img {
height: 14px;
object-fit: cover;
width: 14px;
}
`;
function CompanyChip({ name, picture }: CompanyChipPropsType) {
return (
<StyledContainer data-testid="company-chip">
{picture && (
<Avatar
avatarUrl={picture?.toString()}
placeholder={name}
type="squared"
size={14}
/>
)}
{name}
</StyledContainer>
);
}
export default CompanyChip;