From 0581875dc3754fb90c13532af1e57db133af22c0 Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 28 Sep 2020 13:52:31 +0300 Subject: [PATCH] add notification (beta) --- src/client/Elements/Notification.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/client/Elements/Notification.ts diff --git a/src/client/Elements/Notification.ts b/src/client/Elements/Notification.ts new file mode 100644 index 0000000..e99b02a --- /dev/null +++ b/src/client/Elements/Notification.ts @@ -0,0 +1,27 @@ +import { notification } from 'antd'; +import { throttle } from 'lodash'; + +type TNotification = 'success' | 'info' | 'warning' | 'error'; + +export const openNotification = ({ + type, + title, + description, +}: { + type: TNotification; + title: string; + description: string; +}) => + throttle( + () => + notification[type]({ + message: title, + description, + placement: 'bottomRight', + style: { + zIndex: 9999999999, + }, + }), + 3000, + { trailing: false }, + );