The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { styled } from '@linaria/react';
import { themeCssVariables } from 'twenty-ui/theme';
type VisibilityElementState = 'active' | 'inactive';
type SettingsAccountsVisibilityIconProps = {
className?: string;
metadata?: VisibilityElementState;
subject?: VisibilityElementState;
body?: VisibilityElementState;
};
const StyledCardMedia = styled.div`
align-items: stretch;
border: 2px solid ${themeCssVariables.border.color.medium};
border-radius: ${themeCssVariables.border.radius.sm};
box-sizing: border-box;
color: ${themeCssVariables.font.color.light};
display: flex;
flex-direction: column;
gap: ${themeCssVariables.spacing['0.5']};
height: 40px;
justify-content: center;
padding: ${themeCssVariables.spacing['0.5']};
width: 32px;
`;
const StyledSubjectSkeleton = styled.div<{ isActive?: boolean }>`
background-color: ${({ isActive }) =>
isActive
? themeCssVariables.accent.accent7
: themeCssVariables.background.quaternary};
border-radius: 1px;
height: 3px;
`;
const StyledMetadataSkeleton = styled.div<{ isActive?: boolean }>`
background-color: ${({ isActive }) =>
isActive
? themeCssVariables.accent.accent7
: themeCssVariables.background.quaternary};
border-radius: 1px;
height: 3px;
margin-right: ${themeCssVariables.spacing[2]};
`;
const StyledBodySkeleton = styled.div<{ isActive?: boolean }>`
background-color: ${({ isActive }) =>
isActive
? themeCssVariables.accent.accent7
: themeCssVariables.background.quaternary};
border-radius: ${themeCssVariables.border.radius.xs};
flex: 1 0 auto;
height: 3px;
`;
export const SettingsAccountsVisibilityIcon = ({
className,
metadata,
subject,
body,
}: SettingsAccountsVisibilityIconProps) => (
<StyledCardMedia className={className}>
{!!metadata && <StyledMetadataSkeleton isActive={metadata === 'active'} />}
{!!subject && <StyledSubjectSkeleton isActive={subject === 'active'} />}
{!!body && <StyledBodySkeleton isActive={body === 'active'} />}
</StyledCardMedia>
);