-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29fea52
commit 58ee0af
Showing
12 changed files
with
173 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Bounce, ToastContainer } from 'react-toastify' | ||
|
||
export const AppToastContainer = () => { | ||
return ( | ||
<ToastContainer | ||
position="top-right" | ||
autoClose={3500} | ||
hideProgressBar={false} | ||
newestOnTop={false} | ||
closeOnClick | ||
rtl={false} | ||
pauseOnFocusLoss | ||
draggable | ||
pauseOnHover | ||
theme="light" | ||
transition={Bounce} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './useVisitorId' | ||
export * from './useToast' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useCallback } from 'react' | ||
|
||
import { toast } from 'react-toastify' | ||
|
||
type PromiseToastProps = { | ||
pending: string | ||
success: string | ||
error: string | ||
} | ||
|
||
export const useToast = () => { | ||
const showInfoToast = useCallback((message: string) => { | ||
return toast.info(message) | ||
}, []) | ||
|
||
const showSuccessToast = useCallback((message: string) => { | ||
return toast.success(message) | ||
}, []) | ||
|
||
const showErrorToast = useCallback((message: string) => { | ||
return toast.error(message) | ||
}, []) | ||
|
||
const showWarningToast = useCallback((message: string) => { | ||
return toast.warning(message) | ||
}, []) | ||
|
||
const showPromiseToast = useCallback( | ||
(promise: Promise<unknown>, promiseParams: PromiseToastProps) => { | ||
return toast.promise(promise, promiseParams) | ||
}, | ||
[], | ||
) | ||
|
||
const dismissAllToasts = useCallback(() => { | ||
return toast.dismiss() | ||
}, []) | ||
|
||
const dismissToast = useCallback((toastId: string) => { | ||
return toast.dismiss(toastId) | ||
}, []) | ||
|
||
return { | ||
showToast: toast, | ||
showInfoToast, | ||
showSuccessToast, | ||
showErrorToast, | ||
showWarningToast, | ||
showPromiseToast, | ||
dismissAllToasts, | ||
dismissToast, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters