mirror of
https://github.com/wassname/talk.git
synced 2026-07-16 11:22:16 +08:00
40 lines
784 B
JavaScript
40 lines
784 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import styles from './Button.css';
|
|
import cn from 'classnames';
|
|
|
|
class Button extends React.Component {
|
|
render() {
|
|
const {
|
|
className,
|
|
title,
|
|
onClick,
|
|
children,
|
|
active,
|
|
activeClassName,
|
|
} = this.props;
|
|
return (
|
|
<button
|
|
className={cn(className, styles.button, {
|
|
[cn(styles.active, activeClassName)]: active,
|
|
})}
|
|
title={title}
|
|
onClick={onClick}
|
|
>
|
|
{children}
|
|
</button>
|
|
);
|
|
}
|
|
}
|
|
|
|
Button.propTypes = {
|
|
className: PropTypes.string,
|
|
activeClassName: PropTypes.string,
|
|
title: PropTypes.string,
|
|
onClick: PropTypes.func,
|
|
children: PropTypes.node,
|
|
active: PropTypes.bool,
|
|
};
|
|
|
|
export default Button;
|