-
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
Showing
6 changed files
with
61 additions
and
2 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,38 @@ | ||
import { Icon } from '@iconify/react' | ||
import { Toaster as SonnerToaster } from 'sonner' | ||
|
||
import { useThemeAppearance } from '../../hooks/use-theme' | ||
|
||
type ToasterProps = React.ComponentProps<typeof SonnerToaster> | ||
|
||
const Toaster = ({ ...props }: ToasterProps) => { | ||
const [theme] = useThemeAppearance() | ||
|
||
/** @see {@link https://sonner.emilkowal.ski/styling} */ | ||
return ( | ||
<SonnerToaster | ||
icons={{ | ||
error: <Icon icon="heroicons:exclamation-circle" inline />, | ||
info: <Icon icon="heroicons:information-circle" inline />, | ||
success: <Icon icon="heroicons:check-circle" inline />, | ||
warning: <Icon icon="heroicons:exclamation-circle" inline />, | ||
// loading | ||
}} | ||
theme={theme} | ||
toastOptions={{ | ||
classNames: { | ||
actionButton: 'rt-reset rt-BaseButton rt-r-size-2 rt-variant-solid rt-Button', | ||
cancelButton: 'rt-reset rt-BaseButton rt-r-size-2 rt-variant-soft rt-Button', | ||
description: 'rt-Text rt-r-size-2 rt-r-mt-2', | ||
title: 'rt-Text rt-r-size-2 rt-r-lt-start', | ||
toast: 'rt-BaseDialogContent rt-AlertDialogContent rt-Flex rt-r-ai-center rt-r-gap-2 rt-r-size-2 rt-r-max-w', | ||
}, | ||
style: { overflow: 'hidden' }, | ||
unstyled: true, | ||
}} | ||
{...props} | ||
/> | ||
) | ||
} | ||
|
||
export { Toaster } |
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