99982c0391
• Finished: - updating the reformatting of propTypes and set redux, intl functions to end of component • Removed: - Gif implementation
111 lines
3.0 KiB
JavaScript
111 lines
3.0 KiB
JavaScript
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import Block from '../block'
|
|
import Heading from '../heading'
|
|
import Button from '../button'
|
|
import Text from '../text'
|
|
|
|
class PanelLayout extends React.PureComponent {
|
|
|
|
render() {
|
|
const {
|
|
title,
|
|
subtitle,
|
|
headerButtonTitle,
|
|
headerButtonAction,
|
|
headerButtonTo,
|
|
footerButtonTitle,
|
|
footerButtonAction,
|
|
footerButtonTo,
|
|
footerButtonHref,
|
|
noPadding,
|
|
children,
|
|
} = this.props
|
|
|
|
return (
|
|
<aside className={[_s.d, _s.mb15].join(' ')}>
|
|
<Block>
|
|
{
|
|
(title || subtitle) &&
|
|
<div className={[_s.d, _s.px15, _s.py10].join(' ')}>
|
|
<div className={[_s.d, _s.flexRow, _s.aiCenter].join(' ')}>
|
|
<Heading size='h2'>
|
|
{title}
|
|
</Heading>
|
|
{
|
|
(!!headerButtonTitle && (!!headerButtonAction || !!headerButtonTo)) &&
|
|
<div className={[_s.d, _s.mlAuto].join(' ')}>
|
|
<Button
|
|
isText
|
|
backgroundColor='none'
|
|
color='brand'
|
|
to={headerButtonTo}
|
|
onClick={headerButtonAction}
|
|
>
|
|
<Text size='small' color='inherit' weight='bold'>
|
|
{headerButtonTitle}
|
|
</Text>
|
|
</Button>
|
|
</div>
|
|
}
|
|
</div>
|
|
{
|
|
subtitle &&
|
|
<Heading size='h4'>
|
|
{subtitle}
|
|
</Heading>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
{
|
|
!noPadding &&
|
|
<div className={[_s.d, _s.px15, _s.py10].join(' ')}>
|
|
{children}
|
|
</div>
|
|
}
|
|
|
|
{
|
|
noPadding && children
|
|
}
|
|
|
|
{
|
|
(!!footerButtonTitle && (!!footerButtonAction || !!footerButtonTo || !!footerButtonHref)) &&
|
|
<div className={_s.d}>
|
|
<Button
|
|
isText
|
|
color='none'
|
|
backgroundColor='none'
|
|
to={footerButtonTo}
|
|
href={footerButtonHref}
|
|
onClick={footerButtonAction}
|
|
className={[_s.px15, _s.py15, _s.bgSubtle_onHover].join(' ')}
|
|
>
|
|
<Text color='brand' size='medium'>
|
|
{footerButtonTitle}
|
|
</Text>
|
|
</Button>
|
|
</div>
|
|
}
|
|
</Block>
|
|
</aside>
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
PanelLayout.propTypes = {
|
|
title: PropTypes.string,
|
|
subtitle: PropTypes.string,
|
|
children: PropTypes.node,
|
|
headerButtonTitle: PropTypes.string,
|
|
headerButtonAction: PropTypes.func,
|
|
headerButtonTo: PropTypes.string,
|
|
footerButtonTitle: PropTypes.string,
|
|
footerButtonAction: PropTypes.func,
|
|
footerButtonTo: PropTypes.string,
|
|
footerButtonHref: PropTypes.string,
|
|
noPadding: PropTypes.bool,
|
|
}
|
|
|
|
export default PanelLayout |