bigbuffet-rw/app/soapbox/features/ui/components/column.js

32 lines
1,005 B
JavaScript
Raw Normal View History

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,
};
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'>
{heading && <ColumnHeader icon={icon} active={active} type={heading} columnHeaderId={columnHeaderId} />}
2020-03-27 13:59:38 -07:00
{backBtn}
{children}
</div>
);
}
}