UNPKG

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

41 lines (40 loc) 1.46 kB
import React from 'react'; import { AchievementDetails } from '../types'; /** * Props for the TrophyNotificationToast component */ export interface TrophyNotificationToastProps { /** Position for the toast notifications */ position?: 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center'; /** Duration in milliseconds for how long toasts should be displayed */ duration?: number; /** URL for the sound file to play when achievements are unlocked */ soundUrl?: string; /** Volume level for sound effects (0.0 to 1.0) */ volume?: number; /** Whether sound effects should be enabled */ soundEnabled?: boolean; /** Custom icons to use for achievements */ icons?: Record<string, string>; /** Theme for the toast notifications */ theme?: 'light' | 'dark' | 'system'; /** Whether to close toast on click */ closeOnClick?: boolean; /** Custom render function for achievement toasts */ renderAchievement?: (achievement: AchievementDetails) => React.ReactNode; } /** * TrophyNotificationToast - Shows toast notifications when achievements are unlocked * Includes sound effects using howler.js * * @example * ```tsx * <TrophyNotificationToast * position="top-right" * duration={4000} * soundEnabled={true} * /> * ``` */ declare const TrophyNotificationToast: React.FC<TrophyNotificationToastProps>; export default TrophyNotificationToast;