Text.tsx 568 B

123456789101112131415161718192021222324252627282930
  1. import styled, { css } from "styled-components";
  2. import { Box } from "reflexbox/styled-components";
  3. import { switchProp, ifNotProp } from "styled-tools";
  4. interface Props {
  5. weight?: 300 | 400 | 700;
  6. htmlFor?: string;
  7. }
  8. const Text = styled(Box)<Props>`
  9. ${ifNotProp(
  10. "fontSize",
  11. css`
  12. font-size: ${switchProp("a", {
  13. p: "1rem",
  14. h1: "1.802em",
  15. h2: "1.602em",
  16. h3: "1.424em",
  17. h4: "1.266em",
  18. h5: "1.125em"
  19. })};
  20. `
  21. )}
  22. `;
  23. Text.defaultProps = {
  24. as: "p",
  25. fontWeight: 400
  26. };
  27. export default Text;