accounts-ui/imports/ui/components/Button.jsx

28 lines
661 B
React
Raw Normal View History

2016-03-28 22:34:50 +02:00
import React from 'react';
import { Accounts } from 'meteor/accounts-base';
export class Button extends React.Component {
render () {
2016-04-02 22:49:12 +02:00
const {
label,
href = null,
type,
disabled = false,
className,
onClick
} = this.props;
2016-04-02 15:34:30 +02:00
if (type == 'link') {
return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>;
}
return <button className={ className }
2016-04-02 21:02:28 +02:00
type={ type } 
2016-04-02 15:34:30 +02:00
disabled={ disabled }
onClick={ onClick }>{ label }</button>;
2016-03-28 22:34:50 +02:00
}
}
Button.propTypes = {
onClick: React.PropTypes.func
};
Accounts.ui.Button = Button;