Skip to content

The open alternative to Salesforce, designed for AI.

3.2 KB
Raw Blame
import { IMPORT_CONTACTS_PREVIEW_COMPANIES } from '@/onboarding/constants/ImportContactsPreviewCompanies';
import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { getLogoUrlFromDomainName } from 'twenty-shared/utils';
import { Avatar, Chip } from 'twenty-ui/primitives/data-display';
import { Checkbox } from 'twenty-ui/primitives/input';
import { IconBuildingSkyscraper, IconPlus } from 'twenty-ui/icon';

import { themeCssVariables, useTheme } from 'twenty-ui/theme';

const PREVIEW_ROW_HEIGHT = 32;

const StyledColumn = styled.div`
  background-color: ${themeCssVariables.border.color.light};
  box-sizing: border-box;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 1px;
  height: 100%;
  min-width: 0;
  overflow: hidden;
`;

const StyledRow = styled.div`
  align-items: center;
  background-color: ${themeCssVariables.background.primary};
  box-sizing: border-box;
  display: flex;
  flex-shrink: 0;
  gap: ${themeCssVariables.spacing[1]};
  height: ${PREVIEW_ROW_HEIGHT}px;
  padding: 0 ${themeCssVariables.spacing[1]};
`;

const StyledHeaderTitle = styled.div`
  align-items: center;
  color: ${themeCssVariables.font.color.tertiary};
  display: flex;
  flex: 1 1 0;
  font-size: ${themeCssVariables.font.size.md};
  font-weight: ${themeCssVariables.font.weight.medium};
  gap: ${themeCssVariables.spacing[1]};
  min-width: 0;
  padding-left: ${themeCssVariables.spacing[2]};
`;

const StyledHeaderAction = styled.div`
  align-items: center;
  display: flex;
  height: ${themeCssVariables.spacing[6]};
  justify-content: center;
  width: ${themeCssVariables.spacing[6]};
`;

const StyledCompanyCell = styled.div`
  display: flex;
  padding-left: ${themeCssVariables.spacing[2]};
`;

export const OnboardingImportPreviewCompanies = () => {
  const { t } = useLingui();
  const theme = useTheme();

  return (
    <StyledColumn>
      <StyledRow>
        <Checkbox checked={false} hoverable />
        <StyledHeaderTitle>
          <IconBuildingSkyscraper
            size={theme.icon.size.md}
            color={themeCssVariables.font.color.tertiary}
          />
          {t`Companies`}
        </StyledHeaderTitle>
        <StyledHeaderAction>
          <IconPlus
            size={theme.icon.size.md}
            color={themeCssVariables.font.color.tertiary}
          />
        </StyledHeaderAction>
      </StyledRow>
      {IMPORT_CONTACTS_PREVIEW_COMPANIES.map((company) => (
        <StyledRow key={company.id}>
          <Checkbox checked={false} hoverable />
          <StyledCompanyCell>
            <Chip
              size="sm"
              variant="soft"
              color="primary"
              startElement={
                <Avatar
                  shape="square"
                  size="sm"
                  name={company.name}
                  colorSeed={company.id}
                  src={getAbsoluteImageUrl(
                    getLogoUrlFromDomainName(company.domainName),
                  )}
                />
              }
            >
              {company.name}
            </Chip>
          </StyledCompanyCell>
        </StyledRow>
      ))}
    </StyledColumn>
  );
};