|
|
|
@ -15,6 +15,7 @@ export default class PageContainerHeader extends Component { |
|
|
|
|
tabs: PropTypes.node, |
|
|
|
|
headerCloseText: PropTypes.string, |
|
|
|
|
className: PropTypes.string, |
|
|
|
|
hideClose: PropTypes.bool, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
renderTabs() { |
|
|
|
@ -23,6 +24,37 @@ export default class PageContainerHeader extends Component { |
|
|
|
|
return tabs && <ul className="page-container__tabs">{tabs}</ul>; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderCloseAction() { |
|
|
|
|
const { hideClose, onClose, headerCloseText } = this.props; |
|
|
|
|
|
|
|
|
|
if (hideClose) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (headerCloseText) { |
|
|
|
|
return ( |
|
|
|
|
onClose && ( |
|
|
|
|
<Button |
|
|
|
|
type="link" |
|
|
|
|
className="page-container__header-close-text" |
|
|
|
|
onClick={() => onClose()} |
|
|
|
|
> |
|
|
|
|
{headerCloseText} |
|
|
|
|
</Button> |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
onClose && ( |
|
|
|
|
<div |
|
|
|
|
className="page-container__header-close" |
|
|
|
|
onClick={() => onClose()} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderHeaderRow() { |
|
|
|
|
const { |
|
|
|
|
showBackButton, |
|
|
|
@ -47,14 +79,7 @@ export default class PageContainerHeader extends Component { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const { |
|
|
|
|
title, |
|
|
|
|
subtitle, |
|
|
|
|
onClose, |
|
|
|
|
tabs, |
|
|
|
|
headerCloseText, |
|
|
|
|
className, |
|
|
|
|
} = this.props; |
|
|
|
|
const { title, subtitle, tabs, className, hideClose } = this.props; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
@ -65,26 +90,18 @@ export default class PageContainerHeader extends Component { |
|
|
|
|
> |
|
|
|
|
{this.renderHeaderRow()} |
|
|
|
|
|
|
|
|
|
{title && <div className="page-container__title">{title}</div>} |
|
|
|
|
|
|
|
|
|
{subtitle && <div className="page-container__subtitle">{subtitle}</div>} |
|
|
|
|
|
|
|
|
|
{onClose && headerCloseText ? ( |
|
|
|
|
<Button |
|
|
|
|
type="link" |
|
|
|
|
className="page-container__header-close-text" |
|
|
|
|
onClick={() => onClose()} |
|
|
|
|
> |
|
|
|
|
{headerCloseText} |
|
|
|
|
</Button> |
|
|
|
|
) : ( |
|
|
|
|
onClose && ( |
|
|
|
|
{title && ( |
|
|
|
|
<div |
|
|
|
|
className="page-container__header-close" |
|
|
|
|
onClick={() => onClose()} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
className={classnames('page-container__title', { |
|
|
|
|
'page-container__title--no-margin-right': hideClose, |
|
|
|
|
})} |
|
|
|
|
> |
|
|
|
|
{title} |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
{subtitle && <div className="page-container__subtitle">{subtitle}</div>} |
|
|
|
|
|
|
|
|
|
{this.renderCloseAction()} |
|
|
|
|
|
|
|
|
|
{this.renderTabs()} |
|
|
|
|
</div> |
|
|
|
|