index.tsx 587 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react';
  2. import { Title, Subtitle, Body } from './styled';
  3. type Props = {
  4. variant?: 'title' | 'subtitle' | 'body';
  5. light?: boolean;
  6. children: React.ReactNode;
  7. style?: Record<string, string>;
  8. align?: 'left' | 'center' | 'right';
  9. };
  10. const Typography: React.FC<Props> = ({
  11. variant = 'title',
  12. children,
  13. ...rest
  14. }: Props) => {
  15. let Component = Body;
  16. if (variant === 'title') {
  17. Component = Title;
  18. }
  19. if (variant === 'subtitle') {
  20. Component = Subtitle;
  21. }
  22. return <Component {...rest}>{children}</Component>;
  23. };
  24. export default Typography;