Vulcan/packages/vulcan-accounts/imports/ui/components/Button.jsx

34 lines
840 B
React
Raw Normal View History

2017-05-19 14:42:43 -06:00
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Components, registerComponent } from 'meteor/vulcan:core';
2017-03-15 10:36:02 +08:00
2017-05-19 14:42:43 -06:00
export class AccountsButton extends PureComponent {
2017-03-15 10:36:02 +08:00
render () {
2017-03-15 10:36:02 +08:00
const {
label,
2018-01-25 15:03:03 -06:00
// href = null,
2017-03-15 10:36:02 +08:00
type,
disabled = false,
className,
onClick
} = this.props;
return type === 'link' ?
2018-01-25 15:03:03 -06:00
<a href="#" className={className} onClick={onClick} style={{marginRight: '10px'}}>{label}</a> :
<Components.Button
style={{marginRight: '10px'}}
variant="primary"
2018-01-25 15:03:03 -06:00
className={className}
type={type}
disabled={disabled}
onClick={onClick}>
{label}
</Components.Button>;
2017-03-15 10:36:02 +08:00
}
}
AccountsButton.propTypes = {
2017-05-19 14:42:43 -06:00
onClick: PropTypes.func
2017-03-15 10:36:02 +08:00
};
registerComponent('AccountsButton', AccountsButton);