Skip to content
Snippets Groups Projects

Resolve "Displaying a prompt message when uploading wrong format of overlay"

1 file
+ 7
3
Compare changes
  • Side-by-side
  • Inline
+ 7
3
import { toast } from 'sonner';
import { Toast } from '@/shared/Toast';
const DEFAULT_DURATION_MS = 5000;
type ShowToastArgs = {
type: 'success' | 'error';
message: string;
duration?: number;
};
export const showToast = (args: ShowToastArgs): void => {
toast.custom(t => (
<Toast message={args.message} onDismiss={() => toast.dismiss(t)} type={args.type} />
));
toast.custom(
t => <Toast message={args.message} onDismiss={() => toast.dismiss(t)} type={args.type} />,
{ duration: args.duration ? args.duration : DEFAULT_DURATION_MS },
);
};
Loading