# All files / src/Dropzone Dropzone.styles.ts

93.93% Statements 31/33
73.17% Branches 30/41
83.33% Functions 5/6
93.1% Lines 27/29

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
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    1335x
    5x
    5x
    5x
    5x
    5x
    5x
    5x
    5x

    5x

    5x

    5x

    5x

    5x

    5x

    38x
    38x

    38x

    38x
    38x

    38x

    5x

    5x

    5x
    3x

    5x

    5x

     import styled, { css } from 'styled-components'
    import { ErrorBanner as ErrorBannerBase } from '../Banner/Banner'
    import { Box } from '../Box/Box'
    import { Button } from '../Button/Button'
    import { Flex } from '../Flex/Flex'
    import { getTypographyIntent } from '../Typography/Typography.styles'
    import { borderRadius } from '../_styles/borderRadius'
    import { colors } from '../_styles/colors'
    import { spacing } from '../_styles/spacing'

    export const StyledErrorBanner = styled(ErrorBannerBase)`
      margin-top: ${spacing.lg}px;
      flex-shrink: 0;
    `
    export const StyledErrorBannerDetails = styled.ul`
      margin: ${spacing.xs}px;
      padding: 0;
      list-style-position: inside;
      list-style-type: disc;
    `
    export const StyledDropzoneIcon = styled.div<{ disabled: boolean }>`
      display: flex;
      justify-content: center;
      align-items: center;
      height: 64px;
      color: ${colors.gray45};
      margin-bottom: ${spacing.lg}px;
      transition: all 250ms ease-out;

      ${({ disabled }) =>
        disabled &&
        css`
          height: 72px;
          margin-bottom: ${spacing.sm}px;
        `}

      svg {
        width: auto;
        height: 100%;
      }
    `

    const activeDropzone = css`
      outline: none;
      border: 2px dashed ${colors.blue50};
      background-color: ${colors.blue96};

      & ${StyledDropzoneIcon} {
        color: ${colors.blue50};
        transform: scale(0.95);
      }
    `

    const disabledDropzone = css`
      color: ${colors.gray70};
      border: 2px dashed ${colors.gray85};
      background-color: ${colors.gray98};
      cursor: not-allowed;

      & ${StyledDropzoneIcon} {
        color: ${colors.gray85};
        transform: none;
      }
    `

    export const StyledDropzoneContainer = styled.div<{
      active: boolean
      disabled: boolean
    }>`
      ${getTypographyIntent('body')}

      display: inline-flex;
      justify-content: center;
      align-items: center;
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      min-height: 92px;
      padding: ${spacing.lg}px;
      color: ${colors.gray40};
      border: 2px dashed ${colors.gray70};
      background-color: ${colors.gray96};
      border-radius: ${borderRadius.md}px;
      text-align: center;
      letter-spacing: 0.25px;
      transition: all 250ms ease-out;
      cursor: grab;

      ${({ disabled }) =>
        !disabled &&
        css`
          &:hover {
            ${activeDropzone}
          }
        `}

      ${({ disabled }) => disabled && disabledDropzone}

      ${({ disabled }) =>
        disabled &&
        css`
          &:hover,
          &:focused {
            ${disabledDropzone}
          }
        `}

      ${({ active, disabled }) => active && !disabled && activeDropzone}
    `

    export const StyledDropzoneMessage = styled.div`
      user-select: none;
    `

    export const StyledUploadButton = styled(Button)`
      display: block;
      margin-left: auto;
      margin-right: auto;
      margin-bottom: ${spacing.sm}px;
    `

    export const StyledDropzoneCaption = styled.span<{ error: boolean }>`
      color: ${({ error }) => error && colors.gray15};
    `

    export const StyledDropzoneWrapper = styled(Flex)`
      height: 100%;
    `

    export const StyledDropzoneFocusDetector = styled(Box)`
      height: 100%;
    `