Update frontends/nextjs/src/components/ui/sonner.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
2025-12-29 16:10:39 +00:00
committed by GitHub
parent 1c5c6ec8f1
commit 5f36b15fe3
+18 -1
View File
@@ -2,7 +2,24 @@
/**
* Sonner-compatible toast API using MUI Snackbar
* Provides a drop-in replacement for the 'sonner' package
* Provides a drop-in replacement for the 'sonner' package.
*
* Usage:
*
* ```tsx
* import { Toaster, toast } from '@/components/ui/sonner'
*
* function App() {
* return (
* <>
* <button onClick={() => toast('Default message')}>Show default toast</button>
* <button onClick={() => toast.success('Saved!')}>Show success toast</button>
* <button onClick={() => toast.error('Failed to save')}>Show error toast</button>
* <Toaster />
* </>
* )
* }
* ```
*/
import React, { createContext, useCallback, useContext, useEffect, useState } from 'react'