import React from 'react'; import PropTypes from 'prop-types'; import './Text.scss'; function Text({ className, style, variant, weight, primary, span, children, }) { const classes = []; if (className) classes.push(className); classes.push(`text text-${variant} text-${weight}`); if (primary) classes.push('font-primary'); const textClass = classes.join(' '); if (span) return { children }; if (variant === 'h1') return

{ children }

; if (variant === 'h2') return

{ children }

; if (variant === 's1') return

{ children }

; return

{ children }

; } Text.defaultProps = { className: null, style: null, variant: 'b1', weight: 'normal', primary: false, span: false, }; Text.propTypes = { className: PropTypes.string, style: PropTypes.shape({}), variant: PropTypes.oneOf(['h1', 'h2', 's1', 'b1', 'b2', 'b3']), weight: PropTypes.oneOf(['light', 'normal', 'medium', 'bold']), primary: PropTypes.bool, span: PropTypes.bool, children: PropTypes.node.isRequired, }; export default Text;