Text.tsx 599 B

12345678910111213141516171819202122232425262728293031
  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. color: "hsl(200, 35%, 25%)"
  27. };
  28. export default Text;