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

20% Statements 2/10
0% Branches 0/6
0% Functions 0/2
20% Lines 2/10

    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

    4x

    4x

     import styled from 'styled-components';
    import get from 'extensions/themeGet';
    import icons from 'components/Icon/icons';
    import AlertBorder from './AlertBorder';

    export const SIZE = '1.2em';

    const AlertIcon = styled.i`
      width: ${SIZE};
      height: ${SIZE};
      margin-right: 1em;
      display: inline-block;

      &::before {
        content: ${({ type }) => {
          switch (type) {
            case 'success':
              return `"${icons('checkmark')}"`;
            case 'error':
              return '"!"';
            default:
              return '"i"';
          }
        }};

        border-width: ${get('thicknesses.normal')};
        border-style: solid;
        border-color: ${props => {
          switch (props.type) {
            case 'success':
              return get('colors.positive.default')(props);
            case 'error':
              return get('colors.negative.default')(props);
            default:
              return get('colors.primary.default')(props);
          }
        }};

        background: ${get('colors.background.default')};
        width: ${SIZE};
        height: ${SIZE};
        display: inline-block;
        line-height: ${SIZE};
        font-family: ${get('fonts.icon')};
        text-align: center;
        border-radius: 100%;
        font-size: calc(${SIZE} - 0.3em);
        position: absolute;
        font-style: normal;
      }

      ${AlertBorder} > & {
        margin: 0 1em auto 0;
        flex: 0 0 auto;
      }
    `;

    export default AlertIcon;