@actinc/dls
Version:
Design Language System (DLS) for ACT & Encoura front-end projects.
24 lines • 1.05 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
/**
* Copyright (c) ACT, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { SnackbarContent, useSnackbar } from 'notistack';
import { forwardRef, useCallback } from 'react';
import Alert from "../Alert";
// eslint-disable-next-line react/display-name
export var SnackbarAlert = forwardRef(function (_a, ref) {
var CustomAlert = _a.CustomAlert, id = _a.id, message = _a.message, variant = _a.variant;
var closeSnackbar = useSnackbar().closeSnackbar;
var handleDismiss = useCallback(function () {
closeSnackbar(id);
}, [id, closeSnackbar]);
var Component = CustomAlert || Alert;
return (_jsx(SnackbarContent, { ref: ref, children: _jsx(Component, { onClose: handleDismiss, severity: variant, style: {
width: '100%',
}, variant: "filled", children: message }) }));
});
export default SnackbarAlert;
//# sourceMappingURL=index.js.map