mirror of
https://github.com/funamitech/mastodon
synced 2024-12-15 07:09:03 +09:00
39 lines
901 B
JavaScript
39 lines
901 B
JavaScript
import { PureComponent } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classNames from 'classnames';
|
|
import { Icon } from 'mastodon/components/icon';
|
|
|
|
export default class ColumnHeader extends PureComponent {
|
|
|
|
static propTypes = {
|
|
icon: PropTypes.string,
|
|
type: PropTypes.string,
|
|
active: PropTypes.bool,
|
|
onClick: PropTypes.func,
|
|
columnHeaderId: PropTypes.string,
|
|
};
|
|
|
|
handleClick = () => {
|
|
this.props.onClick();
|
|
};
|
|
|
|
render () {
|
|
const { icon, type, active, columnHeaderId } = this.props;
|
|
let iconElement = '';
|
|
|
|
if (icon) {
|
|
iconElement = <Icon id={icon} fixedWidth className='column-header__icon' />;
|
|
}
|
|
|
|
return (
|
|
<h1 className={classNames('column-header', { active })} id={columnHeaderId || null}>
|
|
<button onClick={this.handleClick}>
|
|
{iconElement}
|
|
{type}
|
|
</button>
|
|
</h1>
|
|
);
|
|
}
|
|
|
|
}
|