gab-social/app/javascript/gabsocial/components/popover/popover_layout.js
mgabdev 43e384554c Remove React, PureComponent global import, added those imports to files directly
• Remove:
- React, PureComponent global import and added those imports to files directly
2020-08-17 15:07:16 -05:00

73 lines
1.7 KiB
JavaScript

import React from 'react'
import Block from '../block'
import Button from '../button'
import Heading from '../heading'
import Text from '../text'
export default class PopoverLayout extends React.PureComponent {
static propTypes = {
children: PropTypes.node,
width: PropTypes.number,
isXS: PropTypes.bool,
title: PropTypes.string,
onClose: PropTypes.func,
}
static defaultProps = {
width: 250,
}
handleOnClose = () => {
this.props.onClose()
}
render() {
const {
children,
width,
isXS,
title,
} = this.props
if (isXS) {
return (
<div className={[_s.default, _s.modal, _s.px10, _s.pb10].join(' ')}>
<div className={[_s.default, _s.bgPrimary, _s.radiusSmall, _s.overflowHidden, _s.mb10].join(' ')}>
{
!!title &&
<div className={[_s.default, _s.flexRow, _s.alignItemsCenter, _s.justifyContentCenter, _s.borderBottom1PX, _s.borderColorSecondary, _s.height53PX, _s.px15].join(' ')}>
<Heading size='2'>
{title}
</Heading>
</div>
}
<div className={[_s.default, _s.heightMax80VH, _s.radiusSmall, _s.overflowYScroll].join(' ')}>
{children}
</div>
</div>
<Button
backgroundColor='primary'
color='primary'
onClick={this.handleOnClose}
radiusSmall
>
<Text color='inherit' size='large' align='center'>
Cancel
</Text>
</Button>
</div>
)
}
return (
<div style={{ width: `${width}px` }} className={_s.modal}>
<Block>
{children}
</Block>
</div>
)
}
}