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

36 lines
964 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 Column from 'soapbox/components/column';
import Pullable from 'soapbox/components/pullable';
2020-03-27 13:59:38 -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,
showBackBtn: PropTypes.bool,
2020-03-27 13:59:38 -07:00
};
static defaultProps = {
showBackBtn: true,
}
render() {
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 (
<Column aria-labelledby={columnHeaderId} {...rest}>
{heading && <ColumnHeader icon={icon} active={active} type={heading} columnHeaderId={columnHeaderId} showBackBtn={showBackBtn} />}
<Pullable>
{children}
</Pullable>
</Column>
2020-03-27 13:59:38 -07:00
);
}
}