mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-25 17:44:14 -05:00
daefbd66a6
* Fix regression from #6199: Style of legacy column headers * Fix tests * Clean up variables
38 lines
842 B
JavaScript
38 lines
842 B
JavaScript
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) {
|
|
iconElement = <i className={`fa 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>
|
|
);
|
|
}
|
|
|
|
}
|