All files / src/Heading styles.ts

100% Statements 4/4
100% Branches 2/2
100% Functions 2/2
100% Lines 2/2

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      23x                                                                                                                           3x              
import { cssClass } from '../styled';
import { fontSize, fontWeight, space, theme } from '../utils';
 
export const Heading = styleProps => cssClass`
  font-weight: ${fontWeight('bold')(styleProps)};
  line-height: 1.2;
 
  .heading& + .sub-heading {
    margin-top: -0.5em;
  }
 
  &:not(:last-child) {
    margin-bottom: ${space(1)(styleProps)}em;
  }
 
  h1& {
    font-size: ${fontSize('700')(styleProps)}rem;
    & {
      ${theme(styleProps.themeKey, `h1.css.root`)(styleProps)};
    }
  }
  h2& {
    font-size: ${fontSize('600')(styleProps)}rem;
    & {
      ${theme(styleProps.themeKey, `h2.css.root`)(styleProps)};
    }
  }
  h3& {
    font-size: ${fontSize('500')(styleProps)}rem;
    & {
      ${theme(styleProps.themeKey, `h3.css.root`)(styleProps)};
    }
  }
  h4& {
    font-size: ${fontSize('400')(styleProps)}rem;
    & {
      ${theme(styleProps.themeKey, `h4.css.root`)(styleProps)};
    }
  }
  h5& {
    font-size: ${fontSize('300')(styleProps)}rem;
    & {
      ${theme(styleProps.themeKey, `h5.css.root`)(styleProps)};
    }
  }
  h6& {
    font-size: ${fontSize('200')(styleProps)}rem;
    & {
      ${theme(styleProps.themeKey, `h6.css.root`)(styleProps)};
    }
  }
 
  & {
    ${styleProps.isSubHeading && getSubHeadingProperties(styleProps)};
  }
 
  & .fp-Icon {
    vertical-align: -0.125em;
  }
 
  & {
    ${theme(styleProps.themeKey, `css.root`)(styleProps)};
  }
`;
 
export const getSubHeadingProperties = styleProps => cssClass`
  font-weight: ${fontWeight('semibold')(styleProps)};
 
  & {
    ${theme(styleProps.themeKey, `subHeading.css.root`)(styleProps)};
  }
`;