react-trophies
Version:
Comprehensive achievement and trophy system for React apps with sound effects, notifications, theming, and visual components. Uses React, React-DOM, Sonner (toast notifications), Howler (sound effects), Zustand (state management), React-Confetti (celebrat
35 lines (34 loc) • 1.29 kB
TypeScript
/**
* Toast utilities for react-trophies
*
* This module provides wrapper functions around sonner's toast capabilities
* to allow for consistent styling of achievement toasts across an application.
*/
import { type ExternalToast } from 'sonner';
/**
* Creates and displays a toast notification using sonner
*
* This is a simple wrapper around sonner's toast function that can be used for
* custom styling across your application. Use undefined to maintain consistent styling
* for trophy notifications.
*
* @param {string} title - The title of the toast
* @param {ExternalToast} options - Options for the toast (same as sonner's options)
* @returns The toast ID
*/
export declare const toast: (title: string, options?: ExternalToast) => string | number;
/**
* Checks if a Toaster component is mounted in the DOM.
* Useful for debugging or adding conditional toast behavior.
*
* @returns {boolean} True if a Toaster component is found in the DOM
*/
export declare const isToasterMounted: () => boolean;
/**
* Helper function to determine if client-side code can safely call toast functions
* to avoid SSR errors when toasting server-side
*
* @returns {boolean} True if toast can be safely called
*/
export declare const canToast: () => boolean;
export default toast;