import React, { ReactNode } from 'react'; import cx from 'classnames'; interface BaseTextProps { extraClass?: string; children: ReactNode; } type SupportedTags = 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'span'; interface TextProps extends BaseTextProps { tag: SupportedTags; } const GenericText = ({ tag, extraClass, children }: TextProps) => { const Tag = tag as keyof JSX.IntrinsicElements; return {children}; }; interface HeaderProps extends BaseTextProps { size: 'h1' | 'h2' | 'h3' | 'h4'; } const Headline = ({ size, extraClass, children }: HeaderProps) => { switch (size) { case 'h1': return {children}; case 'h2': return {children}; case 'h3': return {children}; case 'h4': return {children}; default: throw `Unsupported header size ${size}`; } }; const Link = ({ extraClass, children }: BaseTextProps) => ( {children} ); const Button = ({ extraClass, children }: BaseTextProps) => ( {children} ); interface ParapgraphProps extends BaseTextProps { secondary?: boolean; bold?: boolean; size?: 'large' | 'small'; } const Paragraph = ({ secondary, bold, size, extraClass, children }: ParapgraphProps) => ( {children} ); interface CaptionProps extends BaseTextProps { graph?: boolean; } const Caption = ({ graph, extraClass, children }: CaptionProps) => ( {children} ); const Label = ({ extraClass, children }: BaseTextProps) => ( {children} ); const Menu = ({ extraClass, children }: BaseTextProps) => ( {children} ); export { GenericText, Headline, Link, Button, Paragraph, Caption, Label, Menu, };