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

0% Statements 0/57
0% Branches 0/42
0% Functions 0/20
0% Lines 0/33

    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

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

    const focusAfterStyles = css`
      height: 100%;
      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;
    `;

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

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

        ${appearFocused ? focusAfterStyles : ''};
      }

      &:hover::after,
      &:focus::after {
        ${focusAfterStyles};
      }
    `;

    export const base = css`
      color: ${({ disabled }) => (disabled ? disabledColor : color)};
      font-family: ${get('fonts.brand')};
      opacity: ${({ disabled }) => (disabled ? '0.5' : '1')};

      text-decoration: none;
      cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
      transition: all 0.2s ease;
      white-space: nowrap;
      position: relative;
      height: auto;
      margin: auto;

      ${({ disabled }) => (disabled ? 'pointer-events: none;' : '')} &:focus {
        outline: none;
      }

      &:active {
        color: ${({ disabled }) =>
          disabled ? disabledColor : get('colors.primary.default')};
      }

      ${({ disabled, appearFocused }) =>
        disabled ? '' : reactiveStyles(appearFocused)};
    `;

    const dangerColor = get('colors.negative.default');
    export const negative = css`
      color: ${({ disabled }) => (disabled ? disabledColor : dangerColor)};

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

      &::after {
        background: ${({ disabled }) => (disabled ? '' : dangerColor)};
      }
    `;

    const positiveColor = get('colors.positive.default');
    export const positive = css`
      color: ${({ disabled }) => (disabled ? disabledColor : positiveColor)};

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

      &::after {
        background: ${({ disabled }) => (disabled ? '' : positiveColor)};
      }
    `;

    const darkColor = get('colors.primary.dark');
    export const dark = css`
      color: ${({ disabled }) => (disabled ? disabledColor : darkColor)};

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

      &::after {
        background: ${({ disabled }) => (disabled ? '' : darkColor)};
      }
    `;

    const invertedColor = get('colors.text.inverted');
    export const inverted = css`
      color: ${({ disabled }) => (disabled ? disabledColor : invertedColor)};

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

      &::after {
        background: ${({ disabled }) => (disabled ? '' : invertedColor)};
      }
    `;