Added column back button to column component by default

This commit is contained in:
mgabdev 2019-07-18 23:27:54 -04:00
parent 0510fe0915
commit db480928ec

View File

@ -2,6 +2,8 @@ import React from 'react';
import ColumnHeader from './column_header';
import PropTypes from 'prop-types';
import { isMobile } from '../../../is_mobile';
import ColumnBackButton from '../../../components/column_back_button';
import ColumnBackButtonSlim from '../../../components/column_back_button_slim';
export default class Column extends React.PureComponent {
@ -11,10 +13,11 @@ export default class Column extends React.PureComponent {
children: PropTypes.node,
active: PropTypes.bool,
hideHeadingOnMobile: PropTypes.bool,
backBtnSlim: PropTypes.string,
};
render () {
const { heading, icon, children, active, hideHeadingOnMobile } = this.props;
const { heading, icon, children, active, hideHeadingOnMobile, backBtnSlim } = this.props;
const showHeading = heading && (!hideHeadingOnMobile || (hideHeadingOnMobile && !isMobile(window.innerWidth)));
@ -22,9 +25,13 @@ export default class Column extends React.PureComponent {
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>
);