2020-03-27 13:59:38 -07:00
|
|
|
import React from 'react';
|
|
|
|
import ColumnHeader from './column_header';
|
|
|
|
import PropTypes from 'prop-types';
|
2021-10-06 13:57:24 -07:00
|
|
|
import Column from 'soapbox/components/column';
|
2021-11-03 18:35:40 -07:00
|
|
|
import Pullable from 'soapbox/components/pullable';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2021-10-06 13:57:24 -07:00
|
|
|
export default class UIColumn extends React.PureComponent {
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
heading: PropTypes.string,
|
|
|
|
icon: PropTypes.string,
|
|
|
|
children: PropTypes.node,
|
|
|
|
active: PropTypes.bool,
|
2021-09-12 17:36:18 -07:00
|
|
|
showBackBtn: PropTypes.bool,
|
2020-03-27 13:59:38 -07:00
|
|
|
};
|
|
|
|
|
2021-09-12 17:36:18 -07:00
|
|
|
static defaultProps = {
|
|
|
|
showBackBtn: true,
|
|
|
|
}
|
|
|
|
|
2020-04-14 14:47:35 -07:00
|
|
|
render() {
|
2021-10-06 13:57:24 -07:00
|
|
|
const { heading, icon, children, active, showBackBtn, ...rest } = this.props;
|
2021-01-01 12:11:52 -08:00
|
|
|
const columnHeaderId = heading && heading.replace(/ /g, '-');
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
|
|
return (
|
2021-10-06 13:57:24 -07:00
|
|
|
<Column aria-labelledby={columnHeaderId} {...rest}>
|
2021-09-27 11:38:02 -07:00
|
|
|
{heading && <ColumnHeader icon={icon} active={active} type={heading} columnHeaderId={columnHeaderId} showBackBtn={showBackBtn} />}
|
2021-11-03 18:35:40 -07:00
|
|
|
<Pullable>
|
|
|
|
{children}
|
|
|
|
</Pullable>
|
2021-10-06 13:57:24 -07:00
|
|
|
</Column>
|
2020-03-27 13:59:38 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|