Skip to content
Snippets Groups Projects
Unverified Commit daefbd66 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix style of legacy column headers (#6342)

* Fix regression from #6199: Style of legacy column headers

* Fix tests

* Clean up variables
parent b1daa71d
No related branches found
No related tags found
No related merge requests found
...@@ -21,13 +21,13 @@ describe('<Column />', () => { ...@@ -21,13 +21,13 @@ describe('<Column />', () => {
<div className='scrollable' /> <div className='scrollable' />
</Column> </Column>
); );
wrapper.find(ColumnHeader).simulate('click'); wrapper.find(ColumnHeader).find('button').simulate('click');
expect(global.requestAnimationFrame.mock.calls.length).toEqual(1); expect(global.requestAnimationFrame.mock.calls.length).toEqual(1);
}); });
it('does not try to scroll if there is no scrollable content', () => { it('does not try to scroll if there is no scrollable content', () => {
const wrapper = mount(<Column heading='notifications' />); const wrapper = mount(<Column heading='notifications' />);
wrapper.find(ColumnHeader).simulate('click'); wrapper.find(ColumnHeader).find('button').simulate('click');
expect(global.requestAnimationFrame.mock.calls.length).toEqual(0); expect(global.requestAnimationFrame.mock.calls.length).toEqual(0);
}); });
}); });
......
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class ColumnHeader extends React.PureComponent { export default class ColumnHeader extends React.PureComponent {
...@@ -16,19 +17,20 @@ export default class ColumnHeader extends React.PureComponent { ...@@ -16,19 +17,20 @@ export default class ColumnHeader extends React.PureComponent {
} }
render () { render () {
const { type, active, columnHeaderId } = this.props; const { icon, type, active, columnHeaderId } = this.props;
let iconElement = '';
let icon = ''; if (icon) {
iconElement = <i className={`fa fa-fw fa-${icon} column-header__icon`} />;
if (this.props.icon) {
icon = <i className={`fa fa-fw fa-${this.props.icon} column-header__icon`} />;
} }
return ( return (
<div role='button heading' tabIndex='0' className={`column-header ${active ? 'active' : ''}`} onClick={this.handleClick} id={columnHeaderId || null}> <h1 className={classNames('column-header', { active })} id={columnHeaderId || null}>
{icon} <button onClick={this.handleClick}>
{type} {iconElement}
</div> {type}
</button>
</h1>
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment