import * as React from 'react' ; import styles from './Text.module.scss' ; export interface Props { color ? : 'green' | 'pink' | 'yellow' | 'blue' | 'white' | 'gray' | 'platinum_gray' | 'red' ; type ? : 'h1' | 'h2' | 'h3' | 'p' | 'tr' ; style ? : 'light' ; className ? : string ; } const Text = props => { const color = props . color ?? 'white' ; const type = props . type ?? 'p' ; const styleProps = [ 'root' ] ; styleProps . push ( type ) ; styleProps . push ( `color_${ color }` ) ; if ( props . style ) { styleProps . push ( props . style ) ; } const Tag = [ 'h1' , 'h2' , 'h3' , 'p' ] . includes ( type ) ? type : 'p' ; return ( < Tag className = { `${ styleProps . map ( prop => styles [ prop ] ) . join ( ' ' ) } ${ props . className ?? '' }` } > { props . children } < /Tag>); } ; export default Text ;