feature(components): prop-type Modal

This commit is contained in:
Alexander Klein 2021-02-16 13:28:32 +01:00
parent cf87ec1ea5
commit de18b03803

View File

@ -1,9 +1,10 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { useSpring, animated } from 'react-spring'; import { useSpring, animated } from 'react-spring';
import styles from './Modal.module.css'; import styles from './Modal.module.css';
export default function Modal({ title, children }) { function Modal({ title, children }) {
const props = useSpring({ opacity: 1, from: { opacity: 0 } }); const props = useSpring({ opacity: 1, from: { opacity: 0 } });
return ReactDOM.createPortal( return ReactDOM.createPortal(
@ -16,3 +17,10 @@ export default function Modal({ title, children }) {
document.getElementById('__modals'), document.getElementById('__modals'),
); );
} }
Modal.propTypes = {
title: PropTypes.node,
children: PropTypes.node,
};
export default Modal;