All files / libs/data-capture/fields/components/src/lib/user/null-value UserNullValue.tsx

100% Statements 40/40
33.33% Branches 1/3
100% Functions 0/0
100% Lines 40/40

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 411x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x  
import { IconUserOff } from '@tabler/icons-react';
import { memo } from 'react';
import { FormattedMessage } from 'react-intl';
 
import { Typography, type TypographyProps } from '@allshares/studio-design-system';
 
import { accentuatedLabel, dimmedLabel } from '../../FieldValuePrettyFormat.styles';
import { LabelVariant } from '../../types';
 
import { flex, nullIcon, TYPOGRAPHY_VARIANT } from './UserNullValue.styles';
 
export type UserNullValueProps = Omit<TypographyProps, 'variant'> & {
  readonly variant?: LabelVariant;
};
 
export const UserNullValue = memo(function UserNullValue({
  variant = LabelVariant.DIMMED,
  ...props
}: UserNullValueProps) {
  // DEFAULT and BOLD variants are not supported
  const supportedVariant =
    variant === LabelVariant.DEFAULT || variant === LabelVariant.BOLD ? LabelVariant.DIMMED : variant;
 
  return (
    <Typography
      variant={TYPOGRAPHY_VARIANT[supportedVariant]}
      css={[
        flex,
        supportedVariant === LabelVariant.DIMMED && dimmedLabel,
        supportedVariant === LabelVariant.ACCENTUATED && accentuatedLabel,
      ]}
      {...props}
    >
      <IconUserOff css={nullIcon} />
      <span>
        <FormattedMessage defaultMessage="None" />
      </span>
    </Typography>
  );
});