bigbuffet-rw/app/soapbox/features/ui/components/column_header.js

34 lines
813 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
2020-05-28 15:52:07 -07:00
import Icon from 'soapbox/components/icon';
2020-03-27 13:59:38 -07:00
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() {
2020-03-27 13:59:38 -07:00
const { icon, type, active, columnHeaderId } = this.props;
return (
<h1 className={classNames('column-header', { active })} id={columnHeaderId || null}>
<button onClick={this.handleClick}>
2021-01-01 11:18:06 -08:00
{icon && <Icon id={icon} fixedWidth className='column-header__icon' />}
2020-03-27 13:59:38 -07:00
{type}
</button>
</h1>
);
}
}