1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 05:15:02 +00:00
mon-entreprise/source/components/Overlay.js
Maxime Quandalle 6ea5dd0870 Migration de React "class" à "function"
Le but de la refacto est de généraliser l'utilisation des hook

Nombre de composants convertis: 52
Nombre de composants restants: 12

Il est possible de compter les composants class restants en utilisant
grep "render()"

L'occasion aussi de remplacer la dernière occurence de UNSAFE_componentWillMount
2019-09-11 11:17:23 +02:00

28 lines
696 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import FocusTrap from 'focus-trap-react'
import React from 'react'
import * as animate from 'Ui/animate'
import { LinkButton } from 'Ui/Button'
import './Overlay.css'
export default function Overlay({ onClose, children, ...otherProps }) {
return (
<div id="overlayWrapper">
<animate.fromBottom>
<FocusTrap
focusTrapOptions={{
onDeactivate: onClose,
clickOutsideDeactivates: true
}}>
<div aria-modal="true" id="overlayContent" {...otherProps}>
{children}
<LinkButton
aria-label="close"
onClick={onClose}
id="overlayCloseButton">
×
</LinkButton>
</div>
</FocusTrap>
</animate.fromBottom>
</div>
)
}