UNPKG

amplify-material-ui

Version:

A Material-UI based implementation of aws amplify

26 lines (25 loc) 1.08 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; import * as React from 'react'; import { Toast } from '../ui'; import { useNotificationContext } from './use-notification-context'; export var Notification = function (_a) { var autoHideDuration = _a.autoHideDuration, className = _a.className; var _b = useNotificationContext(), notification = _b.notification, clearNotification = _b.clearNotification; var handleClose = function (_event, reason) { if (reason === 'clickaway') { return; } clearNotification(); }; return (React.createElement(Toast, __assign({ autoHideDuration: autoHideDuration, className: className }, notification, { open: !!notification, onClose: handleClose }))); };