UNPKG

@open-tender/ui

Version:

A component library for use with the Open Tender web app

25 lines (24 loc) 1.05 kB
import React from 'react'; const Text = ({ className, classes, style, text = '', as }) => { const klass = classes ? `${className} ${classes}` : className; const props = { className: klass, 'data-name': className, style }; switch (as) { case 'h1': return React.createElement("h1", Object.assign({}, props), text); case 'h2': return React.createElement("h2", Object.assign({}, props), text); case 'h3': return React.createElement("h3", Object.assign({}, props), text); case 'h4': return React.createElement("h4", Object.assign({}, props), text); case 'h5': return React.createElement("h5", Object.assign({}, props), text); case 'h6': return React.createElement("h6", Object.assign({}, props), text); case 'p': return React.createElement("p", Object.assign({}, props), text); default: return React.createElement("span", Object.assign({}, props), text); } }; export default Text;