UNPKG

@open-tender/ui

Version:

A component library for use with the Open Tender web app

13 lines (12 loc) 830 B
import React from 'react'; const Button = ({ className, classes, style, text = '', icon, iconDisplay = 'hide', disabled = false, children, onClick }) => { const klass = classes ? `${className} ${classes}` : className; const props = { className: klass, 'data-name': className, style }; const iconBefore = !!(icon && iconDisplay === 'before'); const iconAfter = !!(icon && iconDisplay === 'after'); return (React.createElement("button", Object.assign({}, props, { onClick: onClick, disabled: disabled }), children || (React.createElement(React.Fragment, null, iconBefore && React.createElement("span", { style: { lineHeight: 0 } }, icon), React.createElement("span", null, text), iconAfter && React.createElement("span", { style: { lineHeight: 0 } }, icon))))); }; export default Button;