1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-07 18:46:41 +07:00

refactored react imports

This commit is contained in:
Fedor Katurov 2023-11-20 22:35:07 +06:00
parent a9a220273f
commit 7a7b7a4bf9
253 changed files with 679 additions and 479 deletions

View file

@ -1,5 +1,3 @@
import React from 'react';
import classNames from 'classnames';
import toast, { ToastOptions } from 'react-hot-toast';
@ -14,21 +12,30 @@ const defaultOptions: ToastOptions = {
};
export const showToastError = (message: string) =>
toast.error(t => <span onClick={() => toast.dismiss(t.id)}>{message}</span>, {
...defaultOptions,
className: classNames(styles.toast, styles.error),
});
toast.error(
(t) => <span onClick={() => toast.dismiss(t.id)}>{message}</span>,
{
...defaultOptions,
className: classNames(styles.toast, styles.error),
},
);
export const showToastSuccess = (message: string) =>
toast.success(t => <span onClick={() => toast.dismiss(t.id)}>{message}</span>, {
...defaultOptions,
className: classNames(styles.toast, styles.success),
});
toast.success(
(t) => <span onClick={() => toast.dismiss(t.id)}>{message}</span>,
{
...defaultOptions,
className: classNames(styles.toast, styles.success),
},
);
export const showToastInfo = (message: string) =>
toast.success(t => <span onClick={() => toast.dismiss(t.id)}>{message}</span>, {
...defaultOptions,
className: classNames(styles.toast, styles.info),
});
toast.success(
(t) => <span onClick={() => toast.dismiss(t.id)}>{message}</span>,
{
...defaultOptions,
className: classNames(styles.toast, styles.info),
},
);
export const hideToast = (id: string) => toast.dismiss(id);