Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { memo } from 'react'
  2.  
  3. import { H } from 'component/Heading/style'
  4.  
  5. import { theme } from 'shared/theme'
  6.  
  7. export const HeadingType = {
  8.     h1: 'h1',
  9.     h2: 'h2',
  10.     h3: 'h3',
  11.     h4: 'h4',
  12.     h5: 'h5',
  13.     h6: 'h6'
  14. }
  15.  
  16. const HeadingTypography = {
  17.     h1: {
  18.         fontSize: theme.fontSize._6,
  19.         lineHeight: theme.spacing._8
  20.     },
  21.     h2: {
  22.         fontSize: theme.fontSize._5,
  23.         lineHeight: theme.spacing._7
  24.     },
  25.     h3: {
  26.         fontSize: theme.fontSize._4,
  27.         lineHeight: theme.spacing._6
  28.     },
  29.     h4: {
  30.         fontSize: theme.fontSize._3,
  31.         lineHeight: theme.spacing._5
  32.     },
  33.     h5: {
  34.         fontSize: theme.fontSize._2,
  35.         lineHeight: theme.spacing._4
  36.     },
  37.     h6: {
  38.         fontSize: theme.fontSize._1,
  39.         lineHeight: theme.spacing._3
  40.     }
  41. }
  42.  
  43. export const Heading = memo(p => {
  44.     const { as = HeadingType.h2 } = p
  45.  
  46.     return <H {...HeadingTypography[as]} {...p} />
  47. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement