2020-02-22 23:26:23 +00:00
|
|
|
import Block from '../block'
|
2020-02-19 23:57:07 +00:00
|
|
|
import Heading from '../heading'
|
|
|
|
import Button from '../button'
|
2020-02-21 00:57:29 +00:00
|
|
|
import Text from '../text'
|
2019-08-07 06:02:36 +01:00
|
|
|
|
|
|
|
export default class PanelLayout extends PureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
title: PropTypes.string,
|
2020-02-05 22:45:48 +00:00
|
|
|
subtitle: PropTypes.string,
|
2019-08-07 06:02:36 +01:00
|
|
|
children: PropTypes.node,
|
2020-02-21 00:57:29 +00:00
|
|
|
headerButtonTitle: PropTypes.string,
|
|
|
|
headerButtonAction: PropTypes.func,
|
2020-04-22 06:00:11 +01:00
|
|
|
headerButtonTo: PropTypes.string,
|
2020-02-21 00:57:29 +00:00
|
|
|
footerButtonTitle: PropTypes.string,
|
|
|
|
footerButtonAction: PropTypes.func,
|
2020-04-22 06:00:11 +01:00
|
|
|
footerButtonTo: PropTypes.string,
|
2020-02-19 23:57:07 +00:00
|
|
|
noPadding: PropTypes.bool,
|
2020-02-05 22:45:48 +00:00
|
|
|
}
|
2019-08-07 06:02:36 +01:00
|
|
|
|
|
|
|
render() {
|
2020-02-21 00:57:29 +00:00
|
|
|
const {
|
|
|
|
title,
|
|
|
|
subtitle,
|
|
|
|
headerButtonTitle,
|
|
|
|
headerButtonAction,
|
|
|
|
headerButtonTo,
|
|
|
|
footerButtonTitle,
|
|
|
|
footerButtonAction,
|
|
|
|
footerButtonTo,
|
|
|
|
noPadding,
|
|
|
|
children,
|
|
|
|
} = this.props
|
2019-08-07 06:02:36 +01:00
|
|
|
|
|
|
|
return (
|
2020-03-11 23:56:18 +00:00
|
|
|
<aside className={[_s.default, _s.mb15].join(' ')}>
|
2020-02-22 23:26:23 +00:00
|
|
|
<Block>
|
|
|
|
{
|
|
|
|
(title || subtitle) &&
|
2020-04-24 04:17:27 +01:00
|
|
|
<div className={[_s.default, _s.px15, _s.py10].join(' ')}>
|
2020-02-22 23:26:23 +00:00
|
|
|
<div className={[_s.default, _s.flexRow, _s.alignItemsCenter].join(' ')}>
|
2020-04-24 04:17:27 +01:00
|
|
|
<Heading size='h2'>
|
2020-02-22 23:26:23 +00:00
|
|
|
{title}
|
|
|
|
</Heading>
|
|
|
|
{
|
|
|
|
(!!headerButtonTitle && (!!headerButtonAction || !!headerButtonTo)) &&
|
2020-04-24 04:17:27 +01:00
|
|
|
<div className={[_s.default, _s.mlAuto].join(' ')}>
|
2020-02-22 23:26:23 +00:00
|
|
|
<Button
|
2020-04-23 07:13:29 +01:00
|
|
|
isText
|
2020-02-22 23:26:23 +00:00
|
|
|
backgroundColor='none'
|
|
|
|
color='brand'
|
|
|
|
to={headerButtonTo}
|
|
|
|
onClick={headerButtonAction}
|
|
|
|
>
|
|
|
|
<Text size='small' color='inherit' weight='bold'>
|
|
|
|
{headerButtonTitle}
|
|
|
|
</Text>
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
2020-02-08 06:12:01 +00:00
|
|
|
{
|
2020-02-22 23:26:23 +00:00
|
|
|
subtitle &&
|
|
|
|
<Heading size='h4'>
|
|
|
|
{subtitle}
|
|
|
|
</Heading>
|
2020-02-08 06:12:01 +00:00
|
|
|
}
|
2020-02-05 22:45:48 +00:00
|
|
|
</div>
|
2020-02-22 23:26:23 +00:00
|
|
|
}
|
2020-02-19 23:57:07 +00:00
|
|
|
|
2020-02-22 23:26:23 +00:00
|
|
|
{
|
|
|
|
!noPadding &&
|
2020-03-11 23:56:18 +00:00
|
|
|
<div className={[_s.default, _s.px15, _s.py10].join(' ')}>
|
2020-02-22 23:26:23 +00:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
}
|
2020-02-19 23:57:07 +00:00
|
|
|
|
2020-02-22 23:26:23 +00:00
|
|
|
{
|
|
|
|
noPadding && children
|
|
|
|
}
|
2020-02-21 00:57:29 +00:00
|
|
|
|
2020-02-22 23:26:23 +00:00
|
|
|
{
|
|
|
|
(!!footerButtonTitle && (!!footerButtonAction || !!footerButtonTo)) &&
|
2020-04-24 04:17:27 +01:00
|
|
|
<div className={_s.default}>
|
2020-02-22 23:26:23 +00:00
|
|
|
<Button
|
2020-04-23 07:13:29 +01:00
|
|
|
isText
|
2020-02-22 23:26:23 +00:00
|
|
|
color='none'
|
|
|
|
backgroundColor='none'
|
|
|
|
to={footerButtonTo}
|
|
|
|
onClick={footerButtonAction}
|
2020-04-29 23:32:49 +01:00
|
|
|
className={[_s.px15, _s.py15, _s.bgSubtle_onHover].join(' ')}
|
2020-02-22 23:26:23 +00:00
|
|
|
>
|
2020-04-23 07:13:29 +01:00
|
|
|
<Text color='brand' size='medium'>
|
2020-02-22 23:26:23 +00:00
|
|
|
{footerButtonTitle}
|
|
|
|
</Text>
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</Block>
|
2020-02-05 22:45:48 +00:00
|
|
|
</aside>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|