
Removed imports of React, connect, PropTypes throughout Removed the "React" in React.Component/PureComponent
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
import ColumnHeader from './column_header';
|
|
import { isMobile } from '../../../utils/is_mobile';
|
|
import ColumnBackButton from '../../../components/column_back_button';
|
|
import ColumnBackButtonSlim from '../../../components/column_back_button_slim';
|
|
|
|
export default class Column extends PureComponent {
|
|
|
|
static propTypes = {
|
|
heading: PropTypes.string,
|
|
icon: PropTypes.string,
|
|
children: PropTypes.node,
|
|
active: PropTypes.bool,
|
|
hideHeadingOnMobile: PropTypes.bool,
|
|
backBtnSlim: PropTypes.bool,
|
|
};
|
|
|
|
render () {
|
|
const { heading, icon, children, active, hideHeadingOnMobile, backBtnSlim } = this.props;
|
|
|
|
const showHeading = heading && (!hideHeadingOnMobile || (hideHeadingOnMobile && !isMobile(window.innerWidth)));
|
|
|
|
const columnHeaderId = showHeading && heading.replace(/ /g, '-');
|
|
const header = showHeading && (
|
|
<ColumnHeader icon={icon} active={active} type={heading} columnHeaderId={columnHeaderId} />
|
|
);
|
|
|
|
const backBtn = backBtnSlim ? (<ColumnBackButtonSlim/>) : (<ColumnBackButton/>);
|
|
|
|
return (
|
|
<div role='region' aria-labelledby={columnHeaderId} className='column'>
|
|
{header}
|
|
{backBtn}
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
}
|