synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
43 lines (42 loc) • 1.77 kB
TypeScript
import React, { ReactNode } from 'react';
import { AlertButtonConfig } from '../FullWidthAlert/FullWidthAlert';
export type ToastMessageProps = {
text: string;
show: boolean;
autohide: boolean;
};
/**
*
* Generalization of a Material-style toast message used in a couple of places. This component is simple and
* cannot handle issuing multiple toast messages. For more sophisticated cases, see {@link displayToast}
*/
export declare function ToastMessage({ text, show, autohide, }: ToastMessageProps): React.JSX.Element;
/**
* Customized ToastContainer for using react-toastify.
*
* Note that this will collide with other notification systems, such as the BootstrapNotify notifications
* in SWC.
*/
export declare function SynapseToastContainer(): React.ReactNode;
type ToastMessageOptions = {
title?: string;
autoCloseInMs?: number;
primaryButtonConfig?: AlertButtonConfig;
secondaryButtonConfig?: AlertButtonConfig;
dismissOnPrimaryButtonClick?: boolean;
dismissOnSecondaryButtonClick?: boolean;
};
/**
* Displays a toast message. Requires one 'SynapseToastContainer' to be somewhere in the page.
*
* @param message - The description of the toast message.
* @param variant - The type of toast message to display. Default 'info'.
* In ToastMessageOptions:
*
* @param autoCloseInMs - The amount of time in milliseconds to wait before automatically closing the toast. To prevent autoclose, set to 0 or Infinity. Default 15000.
*
* The rest of the options params are undefined by default.
*/
export declare const displayToast: (message: ReactNode, variant?: "info" | "success" | "warning" | "danger", toastMessageOptions?: ToastMessageOptions) => (() => void);
export {};
//# sourceMappingURL=ToastMessage.d.ts.map