# All files / components/Navigation NavigationItem.js

33.33% Statements 3/9
0% Branches 0/4
0% Functions 0/6
33.33% Lines 3/9

    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

    5x

    5x

    5x

     import PropTypes from 'prop-types';
    import styled from 'styled-components';

    const NavigationItem = styled.div.withConfig({ displayName: 'NavigationItem' })`
      border: 0;
      padding: ${({ theme }) => theme.tab.padding};
      opacity: 1;
      transition: all 0.2s ease;
      position: relative;
      cursor: pointer;
      color: ${({ theme, active }) => active ? theme.tab.activeFG : theme.tab.fg};

      &::before {
        content: "";
        background: ${({ theme }) => theme.tab.accent};
        width: 104%;
        height: ${({ active }) => active ? '5px' : 0};
        display: block;
        position: absolute;
        bottom: ${({ theme }) => theme.tab.accentBarBottom};
        top: ${({ theme }) => theme.tab.accentBarTop};
        left: 50%;
        transform: translateX(-50%);
        transition: height 0.2s ease, opacity 0.2s ease;
      }

      &:hover::before {
        opacity: 0.5;
        height: 5px;
      }
    `;

    NavigationItem.propTypes = {
      /**
       * Adds a class name to the element.
       */
      className: PropTypes.string,
      /**
       * Adds an id to the element.
       */
      id: PropTypes.string,
    };

    NavigationItem.defaultProps = {
      className: null,
      id: null,
    };

    export default NavigationItem;