feature(components): prop-type Toast

This commit is contained in:
Alexander Klein 2021-02-16 14:10:04 +01:00
parent f14cafe926
commit 7e96a2a597

View File

@ -1,11 +1,12 @@
import React, { useEffect } from 'react'; import React, { useEffect } 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 './Toast.module.css'; import styles from './Toast.module.css';
import Icon from 'components/common/Icon'; import Icon from 'components/common/Icon';
import Close from 'assets/times.svg'; import Close from 'assets/times.svg';
export default function Toast({ message, timeout = 3000, onClose }) { function Toast({ message, timeout = 3000, onClose }) {
const props = useSpring({ const props = useSpring({
opacity: 1, opacity: 1,
transform: 'translate3d(0,0px,0)', transform: 'translate3d(0,0px,0)',
@ -24,3 +25,11 @@ export default function Toast({ message, timeout = 3000, onClose }) {
document.getElementById('__modals'), document.getElementById('__modals'),
); );
} }
Toast.propTypes = {
message: PropTypes.node,
timeout: PropTypes.number,
onClose: PropTypes.func,
};
export default Toast;