synapse-react-client
Version:
[](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [](https://badge.fury.io/js/synaps
42 lines (40 loc) • 1.61 kB
TypeScript
import React from 'react';
export declare 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 const ToastMessage: React.FunctionComponent<ToastMessageProps>;
/**
* Customized ToastContainer for using react-toastify.
*
* Note that this will collide with other notification systems, such as the BootstrapNotify notifications
* in SWC.
*/
export declare const SynapseToastContainer: React.FunctionComponent;
declare type ToastMessageOptions = {
title?: string;
autoCloseInMs?: number;
primaryButtonText?: string;
onPrimaryButtonClick?: () => void;
secondaryButtonText?: string;
secondaryButtonHref?: string;
};
/**
* 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: string, variant?: "success" | "info" | "warning" | "danger" | undefined, toastMessageOptions?: ToastMessageOptions | undefined) => void;
export {};