github.com/lauslim12/expert-systems@v0.0.0-20221115131159-018513aad29c/web/src/components/FailedToast.tsx (about)

     1  import { UseToastOptions } from '@chakra-ui/react';
     2  
     3  /**
     4   * Displays a failed toast, if, for a reason, a request fails.
     5   *
     6   * @param toast - ChakraUI's toast object
     7   * @param message - Message to be shown in the toast
     8   * @returns Custom, standarized ChakraUI's toast
     9   */
    10  const FailedToast = (
    11    toast: (options?: UseToastOptions | undefined) => string | number | undefined,
    12    message: string
    13  ) =>
    14    toast({
    15      title: 'Error!',
    16      description: message,
    17      status: 'error',
    18      duration: 1500,
    19      isClosable: true,
    20    });
    21  
    22  export default FailedToast;