All files / src/Menu styles.ts

100% Statements 12/12
83.33% Branches 5/6
100% Functions 6/6
100% Lines 6/6

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 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 130      94x                 404x                                                                                                                                                 808x                             28x                   56x           56x                          
import { css, cssClass } from '../styled';
import { palette, space, theme, fontSize, fontWeight } from '../utils';
 
export const Menu = styleProps => cssClass`
  padding: ${space(2)(styleProps)}rem 0;
  width: 100%;
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const MenuItem = styleProps => cssClass`
  background-color: unset;
  cursor: pointer;
  display: block;
  font-weight: ${fontWeight('semibold')(styleProps)};
  padding: ${space(1.5)(styleProps)}rem ${space(4)(styleProps)}rem;
  text-align: left;
  width: 100%;
  transition: background-color 0.1s;
 
  a& {
    color: unset;
    fill: unset;
    text-decoration: unset;
 
    &:hover {
      color: unset;
      fill: unset;
    }
  }
 
  &[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
 
    & {
      ${theme(styleProps.themeKey, `disabled`)(styleProps)};
    }
  }
 
  &:not(:disabled):focus {
    outline: unset;
    background-color: ${palette('white600')(styleProps)};
 
    & {
      ${theme(styleProps.themeKey, `focus`)(styleProps)};
    }
  }
  &:not(:disabled):hover {
    background-color: ${palette('white600')(styleProps)};
 
    & {
      ${theme(styleProps.themeKey, `hover`)(styleProps)};
    }
  }
  &:not(:disabled):focus:active,
  &:not(:disabled):hover:active {
    background-color: ${palette('white700')(styleProps)};
  }
 
  ${styleProps.isActive &&
    css`
      background-color: ${palette('white700')(styleProps)};
 
      &&:hover,
      &&:focus {
        background-color: ${palette('white800')(styleProps)};
      }
 
      & {
        ${theme(styleProps.themeKey, `active`)(styleProps)};
      }
    `}
 
  & .fp-Icon {
    vertical-align: -0.125em;
  }
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const MenuItemIcon = styleProps => cssClass`
  ${styleProps.isBefore &&
    css`
      margin-right: ${space(2)(styleProps)}rem;
    `}
  ${styleProps.isAfter &&
    css`
      margin-left: ${space(2)(styleProps)}rem;
    `}
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const MenuDivider = styleProps => cssClass`
  && {
    margin: ${space(2)(styleProps)}rem 0;
  }
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const MenuGroup = styleProps => cssClass`
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const MenuGroupTitle = styleProps => cssClass`
  color: ${palette('text200')(styleProps)};
  font-size: ${fontSize('100')(styleProps)}rem;
  font-weight: ${fontWeight('semibold')(styleProps)};
  letter-spacing: 1px;
  padding: ${space(2)(styleProps)}rem ${space(4)(styleProps)}rem;
  padding-top: ${space(1)(styleProps)}rem;
  text-transform: uppercase;
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;