2020-03-27 13:59:38 -07:00
|
|
|
import React from 'react';
|
|
|
|
import ColumnHeader from './column_header';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import ColumnBackButton from '../../../components/column_back_button';
|
|
|
|
import ColumnBackButtonSlim from '../../../components/column_back_button_slim';
|
|
|
|
|
|
|
|
export default class Column extends React.PureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
heading: PropTypes.string,
|
|
|
|
icon: PropTypes.string,
|
|
|
|
children: PropTypes.node,
|
|
|
|
active: PropTypes.bool,
|
|
|
|
backBtnSlim: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
2020-04-14 14:47:35 -07:00
|
|
|
render() {
|
2021-01-01 11:18:06 -08:00
|
|
|
const { heading, icon, children, active, backBtnSlim } = this.props;
|
2021-01-01 12:11:52 -08:00
|
|
|
const columnHeaderId = heading && heading.replace(/ /g, '-');
|
2020-04-14 11:44:40 -07:00
|
|
|
const backBtn = backBtnSlim ? (<ColumnBackButtonSlim />) : (<ColumnBackButton />);
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div role='region' aria-labelledby={columnHeaderId} className='column'>
|
2021-01-01 12:25:48 -08:00
|
|
|
{heading && <ColumnHeader icon={icon} active={active} type={heading} columnHeaderId={columnHeaderId} />}
|
2020-03-27 13:59:38 -07:00
|
|
|
{backBtn}
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|