mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
27 lines
631 B
JavaScript
27 lines
631 B
JavaScript
import './button.css';
|
|
import { createElement } from 'rax';
|
|
|
|
/**
|
|
* Primary UI component for user interaction
|
|
*/
|
|
export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
|
|
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
return (
|
|
<button
|
|
type="button"
|
|
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
style={backgroundColor && { backgroundColor }}
|
|
{...props}
|
|
>
|
|
{label}
|
|
</button>
|
|
);
|
|
};
|
|
|
|
Button.defaultProps = {
|
|
backgroundColor: null,
|
|
primary: false,
|
|
size: 'medium',
|
|
onClick: undefined,
|
|
};
|