# All files / components/Anchor/styles ExternalTextAnchor.js

91.67% Statements 11/12
0% Branches 0/2
0% Functions 0/1
91.67% Lines 11/12

    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

    4x

    4x

    4x

    4x

    4x

    4x

    4x

    4x

    4x

    4x

    4x

     import styled, { css } from 'styled-components';
    import get from 'extensions/themeGet';
    import icons from 'components/Icon/icons';

    const color = get('colors.primary.alternate');

    const newTabIconStyles = css`
      &::before {
        content: "${icons('openInWindow')}";
        font-family: ${get('fonts.icon')};
        opacity: 0;
        background: ${get('colors.background.default')};
        position: absolute;
        right: 0;
        z-index: 1;
        transition: right 0.3s ease, opacity 0.2s ease;
      }

      &:hover::before {
        right: -1.5em;
        opacity: 1;
        transition: right 0.3s ease, opacity 0.2s ease 0.1s;
      }
    `;

    const ExternalTextAnchor = styled.a`
      color: ${color};
      font-family: ${get('fonts.brand')};

      text-decoration: none;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
      position: relative;
      height: auto;
      margin: auto;

      &:focus {
        outline: none;
      }

      &:active {
        color: ${get('colors.primary.default')};
      }

      &::after {
        content: '';
        background: ${color};
        border-radius: 2em;
        height: 1px;
        width: 100%;
        position: absolute;
        bottom: -0.1em;
        left: 0;
        transition: height 0.15s ease, width 0.15s ease, left 0.15s ease,
          opacity 0.25s ease;
      }

      &:hover::after,
      &:focus::after {
        height: calc(100% + 0.2em);
        width: calc(100% + 0.6em);
        left: -0.3em;
        opacity: 0.125;
        transition: height 0.15s ease, width 0.15s ease, left 0.15s ease,
          opacity 0s ease;
      }

      ${({ newTab }) => (newTab ? newTabIconStyles : '')};
    `;

    const dangerColor = get('colors.negative.default');

    ExternalTextAnchor.Danger = ExternalTextAnchor.Negative = ExternalTextAnchor.extend`
      color: ${dangerColor};

      &:active {
        color: ${get('colors.negative.dark')};
      }

      &::after {
        background: ${dangerColor};
      }
    `;

    const positiveColor = get('colors.positive.default');

    ExternalTextAnchor.Positive = ExternalTextAnchor.extend`
      color: ${positiveColor};

      &:active {
        color: ${get('colors.positive.dark')};
      }

      &::after {
        background: ${positiveColor};
      }
    `;

    const darkColor = get('colors.primary.dark');

    ExternalTextAnchor.Dark = ExternalTextAnchor.extend`
      color: ${darkColor};

      &:active {
        color: ${get('colors.primary.dark')};
      }

      &::after {
        background: ${darkColor};
      }
    `;

    const invertedColor = get('colors.text.inverted');

    ExternalTextAnchor.Inverted = ExternalTextAnchor.extend`
      color: ${invertedColor};

      &:active {
        color: ${get('colors.text.inverted')};
      }

      &::after {
        background: ${invertedColor};
      }
    `;

    export default ExternalTextAnchor;