bastienrobert/la-ferme

View on GitHub
packages/mobile/src/components/typo/Title.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import React, { FC } from 'react'

import { Typo, TypoProps } from '@la-ferme/components/native'

export type TitlePreset = 'H1' | 'H2' | 'H3' | 'H4' | 'H5'

export interface TitleProps extends TypoProps {
  preset?: TitlePreset
}

const Title: FC<TitleProps> = ({
  children,
  preset,
  color = 'gray',
  textAlign = 'left',
  ...style
}) => {
  const props = Typo.presets[preset]

  return (
    <Typo color={color} textAlign={textAlign} {...props} {...style}>
      {children}
    </Typo>
  )
}

export default Title