2018-05-24 12:38:21 +00:00
|
|
|
|
import FocusTrap from 'focus-trap-react'
|
2018-01-30 14:16:32 +00:00
|
|
|
|
import React, { Component } from 'react'
|
2018-07-25 14:07:53 +00:00
|
|
|
|
import * as animate from 'Ui/animate'
|
2018-07-12 08:09:41 +00:00
|
|
|
|
import { LinkButton } from 'Ui/Button'
|
2018-01-30 14:16:32 +00:00
|
|
|
|
import './Overlay.css'
|
|
|
|
|
export default class Overlay extends Component {
|
|
|
|
|
render() {
|
2018-07-25 14:07:53 +00:00
|
|
|
|
const { onClose, children, ...otherProps } = this.props
|
2018-01-30 14:16:32 +00:00
|
|
|
|
return (
|
2018-05-24 12:38:21 +00:00
|
|
|
|
<div id="overlayWrapper" onClick={onClose}>
|
2018-07-25 14:07:53 +00:00
|
|
|
|
<animate.fromBottom>
|
|
|
|
|
<FocusTrap
|
|
|
|
|
focusTrapOptions={{
|
|
|
|
|
onDeactivate: onClose,
|
|
|
|
|
clickOutsideDeactivates: true
|
2018-05-24 12:38:21 +00:00
|
|
|
|
}}>
|
2018-07-25 14:07:53 +00:00
|
|
|
|
<div
|
|
|
|
|
aria-modal="true"
|
|
|
|
|
id="overlayContent"
|
|
|
|
|
{...otherProps}
|
|
|
|
|
onClick={e => {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
e.stopPropagation()
|
|
|
|
|
}}>
|
|
|
|
|
{children}
|
|
|
|
|
<LinkButton
|
|
|
|
|
aria-label="close"
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
id="overlayCloseButton">
|
2018-10-02 16:28:56 +00:00
|
|
|
|
×
|
2018-07-25 14:07:53 +00:00
|
|
|
|
</LinkButton>
|
|
|
|
|
</div>
|
|
|
|
|
</FocusTrap>
|
|
|
|
|
</animate.fromBottom>
|
2018-01-30 14:16:32 +00:00
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|