From daefbd66a653b11a17be73b7b0a4ca200b466cec Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 24 Jan 2018 04:03:51 +0100 Subject: [PATCH] Fix style of legacy column headers (#6342) * Fix regression from #6199: Style of legacy column headers * Fix tests * Clean up variables --- .../ui/components/__tests__/column-test.js | 4 ++-- .../features/ui/components/column_header.js | 20 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js b/app/javascript/mastodon/features/ui/components/__tests__/column-test.js index 1e5e1d8dc5..11cc1b6e88 100644 --- a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js +++ b/app/javascript/mastodon/features/ui/components/__tests__/column-test.js @@ -21,13 +21,13 @@ describe('', () => {
); - wrapper.find(ColumnHeader).simulate('click'); + wrapper.find(ColumnHeader).find('button').simulate('click'); expect(global.requestAnimationFrame.mock.calls.length).toEqual(1); }); it('does not try to scroll if there is no scrollable content', () => { const wrapper = mount(); - wrapper.find(ColumnHeader).simulate('click'); + wrapper.find(ColumnHeader).find('button').simulate('click'); expect(global.requestAnimationFrame.mock.calls.length).toEqual(0); }); }); diff --git a/app/javascript/mastodon/features/ui/components/column_header.js b/app/javascript/mastodon/features/ui/components/column_header.js index fdf9aab1a5..e8bdd8054f 100644 --- a/app/javascript/mastodon/features/ui/components/column_header.js +++ b/app/javascript/mastodon/features/ui/components/column_header.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import classNames from 'classnames'; export default class ColumnHeader extends React.PureComponent { @@ -16,19 +17,20 @@ export default class ColumnHeader extends React.PureComponent { } render () { - const { type, active, columnHeaderId } = this.props; + const { icon, type, active, columnHeaderId } = this.props; + let iconElement = ''; - let icon = ''; - - if (this.props.icon) { - icon = ; + if (icon) { + iconElement = ; } return ( -
- {icon} - {type} -
+

+ +

); }