-
Notifications
You must be signed in to change notification settings - Fork 1
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
da6c9f3
commit 345c6b8
Showing
9 changed files
with
45 additions
and
33 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
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,36 @@ | ||
import { AlertCircle, CheckCircle, ClipboardCopy } from 'lucide-react'; | ||
import { Toaster, resolveValue } from 'react-hot-toast'; | ||
|
||
import TextButton from './styled/TextButton'; | ||
|
||
const ToastProvider = () => ( | ||
<Toaster> | ||
{t => { | ||
const msgString = typeof t.message === 'string' ? t.message : ''; | ||
return ( | ||
<div className="tw-surface flex max-w-sm items-center gap-2 bg-darkGray"> | ||
{t.type === 'error' && ( | ||
<AlertCircle size={18} className="shrink-0 text-red" /> | ||
)} | ||
{t.type === 'success' && ( | ||
<CheckCircle size={18} className="shrink-0 text-green" /> | ||
)} | ||
<p title={msgString} className="truncate"> | ||
{resolveValue(t.message, t)} | ||
</p> | ||
|
||
{t.type === 'error' && msgString && ( | ||
<TextButton | ||
title="Copy message" | ||
onClick={() => navigator.clipboard.writeText(msgString)} | ||
icon={ClipboardCopy} | ||
className="-m-2 shrink-0" | ||
/> | ||
)} | ||
</div> | ||
); | ||
}} | ||
</Toaster> | ||
); | ||
|
||
export default ToastProvider; |
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