// @flow
import { getPaletteColor } from '../../mixins/branding';
import type { ThemeProps } from '../../types';
import type { FileUploaderProps } from './file-uploader.proptypes';

export const getDropzoneHeight = (props: FileUploaderProps) =>
  props.attachments && props.attachments.length > 0 ? undefined : '200px';

export const getDropzoneOpacity = (props: FileUploaderProps) =>
  props.savePending ? 0.5 : 1;

export const getDropzoneBorderColor = ({
  theme,
  attachmentsError,
}: FileUploaderProps & ThemeProps) =>
  getPaletteColor(attachmentsError != null ? 'error-fg' : 'greyscale-light')({
    theme,
  });
