mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
refactor(core): replace all notification relies on jotai (#6417)
- remove all notification that implemented with jotai and replaced with new `notify` - Add some notify presets: - `notify.error` - `notify.success` - `notify.warning`
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { SingleSelectSelectSolidIcon } from '@blocksuite/icons';
|
||||
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
||||
import { type CSSProperties, type FC, useMemo } from 'react';
|
||||
import { type ExternalToast, toast, Toaster } from 'sonner';
|
||||
@@ -54,6 +55,29 @@ export function notify(notification: Notification, options?: ExternalToast) {
|
||||
}, options);
|
||||
}
|
||||
|
||||
notify.error = (notification: Notification, options?: ExternalToast) => {
|
||||
return notify({ style: 'alert', theme: 'error', ...notification }, options);
|
||||
};
|
||||
|
||||
notify.success = (notification: Notification, options?: ExternalToast) => {
|
||||
return notify(
|
||||
{
|
||||
icon: <SingleSelectSelectSolidIcon />,
|
||||
style: 'alert',
|
||||
theme: 'success',
|
||||
...notification,
|
||||
},
|
||||
options
|
||||
);
|
||||
};
|
||||
|
||||
notify.warning = (notification: Notification, options?: ExternalToast) => {
|
||||
return notify(
|
||||
{ style: 'information', theme: 'warning', ...notification },
|
||||
options
|
||||
);
|
||||
};
|
||||
|
||||
notify.custom = (
|
||||
Component: FC<NotificationCustomRendererProps>,
|
||||
options?: ExternalToast
|
||||
|
||||
Reference in New Issue
Block a user