mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-24 10:28:06 +01:00
6a6a62f13f
* fix(column_header): Invalid ARIA role * fix(column): Remove hidden nodes from the DOM * refactor(column_link): Remove unused property hideOnMobile * fix(column_header): Use aria-pressed * fix(column_header): Make collapsed content not focusable, add focusable property * fix(column_loading): Make header non-focusable * fix(column_settings): Use role to group the toggles
35 lines
794 B
JavaScript
35 lines
794 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
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 { type, active, columnHeaderId } = this.props;
|
|
|
|
let icon = '';
|
|
|
|
if (this.props.icon) {
|
|
icon = <i className={`fa fa-fw fa-${this.props.icon} column-header__icon`} />;
|
|
}
|
|
|
|
return (
|
|
<div role='heading' tabIndex='0' className={`column-header ${active ? 'active' : ''}`} onClick={this.handleClick} id={columnHeaderId || null}>
|
|
{icon}
|
|
{type}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
}
|