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

0% Statements 0/24
0% Branches 0/10
0% Functions 0/3
0% Lines 0/16

    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

     import styled, { css } from 'styled-components';
    import get from 'extensions/themeGet';
    import icons from 'components/Icon/icons';
    import { base, positive, negative, dark, inverted } from './sharedStyles';

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

    const focusBeforeStyles = css`
      right: -1.5em;
      opacity: 1;
      transition: right 0.3s ease, opacity 0.2s ease 0.1s;
    `;

    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;

        ${({ appearFocused }) => (appearFocused ? focusBeforeStyles : '')}
      }

      &:hover::before {
        ${focusBeforeStyles}
      }
    `;

    const ExternalTextAnchor = styled.a`
      ${base} ${({ newTab, disabled }) =>
        newTab && !disabled ? newTabIconStyles : ''};
    `;

    ExternalTextAnchor.Negative = styled(ExternalTextAnchor)`
      ${negative};
    `;
    ExternalTextAnchor.Danger = ExternalTextAnchor.Negative;

    ExternalTextAnchor.Positive = styled(ExternalTextAnchor)`
      ${positive};
    `;

    ExternalTextAnchor.Dark = styled(ExternalTextAnchor)`
      ${dark};
    `;

    ExternalTextAnchor.Inverted = styled(ExternalTextAnchor)`
      ${inverted};
    `;

    export default ExternalTextAnchor;