28 lines
632 B
JavaScript
28 lines
632 B
JavaScript
import React from 'react';
|
|
|
|
/**
|
|
* Button component
|
|
*
|
|
* @param {object} props
|
|
* @param {string} props.btnStyle space-separated button classes, like default,large,etc.
|
|
*/
|
|
export function Button(props = { btnStyle: 'default' }) {
|
|
const args = {
|
|
btnStyle: 'default',
|
|
...props
|
|
};
|
|
|
|
let classes = (String(args.className)).length > 0
|
|
? ['btn'].concat(String(args.className).split(' '))
|
|
: ['btn'];
|
|
const styleClasses = String(args.btnStyle).split(' ')
|
|
.map(c => `btn-${c}`);
|
|
classes = classes.concat(styleClasses);
|
|
|
|
return (
|
|
<button className={classes.join(' ')}>{args.children}</button>
|
|
);
|
|
}
|
|
|
|
export default Button;
|