mon-entreprise/source/components/Overlay.js

39 lines
909 B
JavaScript
Raw Permalink Normal View History

import FocusTrap from 'focus-trap-react'
import React, { Component } from 'react'
import * as animate from 'Ui/animate'
2018-07-12 08:09:41 +00:00
import { LinkButton } from 'Ui/Button'
import './Overlay.css'
export default class Overlay extends Component {
render() {
const { onClose, children, ...otherProps } = this.props
return (
<div id="overlayWrapper" onClick={onClose}>
<animate.fromBottom>
<FocusTrap
focusTrapOptions={{
onDeactivate: onClose,
clickOutsideDeactivates: true
}}>
<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
×
</LinkButton>
</div>
</FocusTrap>
</animate.fromBottom>
</div>
)
}
}