# All files / components/Alert/styles AlertBorder.js

0% Statements 0/34
0% Branches 0/15
0% Functions 0/6
0% Lines 0/24

    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

     import styled, { keyframes } from 'styled-components';
    import get from 'extensions/themeGet';
    import tag from 'clean-tag';
    import userSpacing from 'extensions/userSpacing';

    const fadeIn = keyframes`
      from { opacity: 0; }
      to { opacity: 1; }
    `;

    const AlertBorder = styled(tag.div).attrs({
      spacing: userSpacing,
    })`
      font-weight: 200;
      border-width: ${get('thicknesses.normal')};
      border-style: solid;
      width: auto;
      font-size: 14px;
      line-height: 1.5em;
      letter-spacing: 0.02em;
      margin: ${props => props.spacing};
      animation: ${fadeIn} 0.2s ease;
      transition: opacity 0.2s ease;

      background: ${({ theme, type }) => {
        switch (type) {
          case 'success':
            return get('colors.positive.light');
          case 'error':
            return get('colors.negative.light');
          default:
            return get('colors.primary.light');
        }
      }};

      border-color: ${({ theme, type }) => {
        switch (type) {
          case 'success':
            return get('colors.positive.border');
          case 'error':
            return get('colors.negative.border');
          default:
            return get('colors.primary.border');
        }
      }};

      color: ${({ theme, type }) => {
        switch (type) {
          case 'success':
            return get('colors.positive.dark');
          case 'error':
            return get('colors.negative.dark');
          default:
            return get('colors.primary.dark');
        }
      }};

      opacity: ${props => (props.closing ? '0' : '1')};
    `;

    AlertBorder.Small = styled(AlertBorder)`
      font-size: 0.8em;
      font-weight: 300;
    `;

    export default AlertBorder;