# All files / src/components/Menu index.tsx

60% Statements 12/20
100% Branches 0/0
0% Functions 0/3
68.75% Lines 11/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x

    1x

    1x

     import type { FC } from 'react';
    import { Heading } from '@cutting/component-library';
    import cs from 'classnames';
    import { useState } from 'react';
    import { NavLink } from 'react-router-dom';
    import * as urls from '../../urls';
    import { MobileNavButton } from '../MobileNavButton';
    import { Cow } from '../Svg';
    import { MenuItems, MobileMenuItems } from './MenuItems';
    import * as Urls from 'src/urls';

    import styles from './Menu.module.scss';

    export interface MenuState {
      isExpanded: boolean;
    }

    export const Menu: FC = () => {
      const [expanded, setExpanded] = useState(false);

      const collapse = (): void => setExpanded(false);
      const toggleIsExpanded = (): void => {
        setExpanded(!expanded);
      };

      return (
        <nav className={styles.container}>
          <div className={styles.full}>
            <ul>
              <li className={styles.logo__container}>
                <NavLink aria-label="home" to={urls.Home}>
                  <Cow />
                </NavLink>
              </li>
              <li>
                <Heading level={2}>
                  <NavLink aria-label="home" className={styles.name} to={urls.Home}>
                    Paul Cowan
                  </NavLink>
                </Heading>
              </li>
              <li className={cs(styles['contact'], styles.horizontal)}>
                <NavLink to={Urls.ContactMe} activeClassName={styles.active} onClick={collapse}>
                  Contact
                </NavLink>
              </li>
              <li className={styles.mobile__button__container}>
                <MobileNavButton onClick={toggleIsExpanded} isActive={expanded} />
              </li>
              <MenuItems collapse={collapse} />
            </ul>
          </div>
          <div className={cs(styles.expandable, { [styles.expanded]: expanded })}>
            <ul>
              <MobileMenuItems collapse={collapse} />
            </ul>
          </div>
        </nav>
      );
    };