0
0
instrumental/app/javascript/mastodon/features/ui/components/column_header.js

38 lines
843 B
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class ColumnHeader extends React.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) {
2018-09-28 00:08:56 +09:00
iconElement = <i className={`fas fa-fw fa-${icon} column-header__icon`} />;
}
return (
<h1 className={classNames('column-header', { active })} id={columnHeaderId || null}>
<button onClick={this.handleClick}>
{iconElement}
{type}
</button>
</h1>
);
}
}