All files / src/TopNav styles.ts

100% Statements 6/6
88.89% Branches 16/18
100% Functions 3/3
100% Lines 3/3

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      11x                   22x                                         77x                                                                                                                                                            
import { css, cssClass } from '../styled';
import { borderRadius, fontWeight, palette, space, theme } from '../utils';
 
export const TopNav = styleProps => cssClass`
  display: flex;
  justify-content: space-between;
  min-height: 60px;
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const TopNavSection = styleProps => cssClass`
  display: flex;
 
  &:not(:last-child) {
    margin-right: ${space(2, 'major')(styleProps)}rem;
  }
 
  &&&&& li {
    align-items: center;
    display: flex;
  }
 
  &&&&& > *:not(:last-child) {
    margin-right: ${space(1, 'minor')(styleProps)}rem;
  }
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const TopNavItem = styleProps => cssClass`
  align-items: center;
  color: inherit;
  height: 100%;
  font-weight: ${fontWeight('semibold')(styleProps)};
  text-decoration: none;
 
  &&&& {
    display: flex;
  }
 
  ${(styleProps.href || styleProps.onClick || styleProps.navId) &&
    css`
      cursor: pointer;
      padding: 0 0.8rem;
    `}
 
  ${styleProps.variant === 'default' &&
    css`
      min-height: 2.75rem;
    `}
 
  ${styleProps.variant === 'pill' &&
    css`
      border-radius: ${borderRadius('default')(styleProps)};
      height: 44px;
    `}
 
  ${styleProps.isActive &&
    css`
      color: ${palette(styleProps.palette, styleProps.palette)(styleProps)};
      fill: ${palette(styleProps.palette, styleProps.palette)(styleProps)};
 
      ${styleProps.variant === 'default' &&
        css`
          box-shadow: inset 0 -2px 0 0 ${palette(styleProps.palette, styleProps.palette)(styleProps)};
        `}
 
      & {
        ${theme(styleProps.themeKey, `css.active`)(styleProps)};
      }
    `}
 
  &:hover {
    ${styleProps.variant !== 'pill' &&
      css`
        color: ${palette(styleProps.palette, styleProps.palette)(styleProps)};
      `}
 
    ${styleProps.variant === 'pill' &&
      css`
        background-color: ${palette('white700')(styleProps)};
      `}
 
    & {
      ${theme(styleProps.themeKey, `css.hover`)(styleProps)};
    }
  }
 
  &:focus {
    outline: none;
    color: ${palette(styleProps.palette, styleProps.palette)(styleProps)};
    fill: ${palette(styleProps.palette, styleProps.palette)(styleProps)};
 
    ${styleProps.variant === 'default' &&
      css`
        box-shadow: inset 0 -2px 0 0 ${palette(styleProps.palette, styleProps.palette)(styleProps)};
      `}
 
    & {
      ${theme(styleProps.themeKey, `css.focus`)(styleProps)};
    }
  }
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;