All files / file-uploader styled-components.js

100% Statements 9/9
75% Branches 12/16
100% Functions 4/4
100% Lines 8/8

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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65                      1x 14x                                               1x     9x                 1x     6x             14x         1x  
/*
Copyright (c) 2018-2019 Uber Technologies, Inc.
 
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
 
import {styled} from '../styles/index.js';
import type {StylePropsT} from './types.js';
 
export const StyledFileDragAndDrop = styled<StylePropsT>('div', props => {
  return ({
    alignItems: 'center',
    backgroundColor: props.$isDragActive
      ? props.$theme.colors.fileUploaderBackgroundColorActive
      : props.$theme.colors.fileUploaderBackgroundColor,
    borderColor: props.$isDragActive
      ? props.$theme.colors.fileUploaderBorderColorActive
      : props.$theme.colors.fileUploaderBorderColorDefault,
    borderStyle: props.$afterFileDrop ? 'none' : 'dashed',
    borderWidth: props.$theme.sizing.scale0,
    boxSizing: 'border-box',
    display: 'flex',
    flexDirection: 'column',
    outline: props.$isDisabled ? 'none' : null,
    paddingTop: props.$theme.sizing.scale900,
    paddingRight: props.$theme.sizing.scale800,
    paddingBottom: props.$afterFileDrop
      ? props.$theme.sizing.scale300
      : props.$theme.sizing.scale900,
    paddingLeft: props.$theme.sizing.scale800,
    width: '100%',
  }: {});
});
 
export const StyledContentMessage = styled<StylePropsT>(
  'div',
  props =>
    ({
      ...props.$theme.typography.font400,
      color: props.$afterFileDrop
        ? props.$theme.colors.fileUploaderMessageColor
        : null,
      marginBottom: props.$afterFileDrop ? props.$theme.sizing.scale600 : null,
    }: {}),
);
 
export const StyledErrorMessage = styled<StylePropsT>(
  'div',
  props =>
    ({
      ...props.$theme.typography.font400,
      color: props.$theme.colors.negative,
      marginBottom: props.$afterFileDrop ? props.$theme.sizing.scale600 : null,
    }: {}),
);
 
export const StyledRoot = styled<StylePropsT>('div', props => ({
  ...props.$theme.typography.font400,
  color: props.$theme.colors.fileUploaderMessageColor,
}));
 
export const StyledHiddenInput = styled('input', {});