🔧 chore: use buttonbaseprops, duration 2000 default
This commit is contained in:
parent
5836779403
commit
cb928c3360
@ -1,13 +1,15 @@
|
|||||||
// Inspired by react-hot-toast library
|
// Inspired by react-hot-toast library
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { type ToastProps } from '@radix-ui/react-toast';
|
import { type ToastProps } from '@radix-ui/react-toast';
|
||||||
|
import { SimpleToastProps } from './SimpleToast';
|
||||||
|
|
||||||
const TOAST_LIMIT = 3;
|
const TOAST_LIMIT = 3;
|
||||||
const TOAST_REMOVE_DELAY_DEFAULT = 7000;
|
const TOAST_REMOVE_DELAY_DEFAULT = 7000;
|
||||||
|
|
||||||
type ToasterToast = ToastProps & {
|
type ToasterToast = ToastProps &
|
||||||
id: string;
|
SimpleToastProps & {
|
||||||
};
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
const actionTypes = {
|
const actionTypes = {
|
||||||
ADD_TOAST: 'ADD_TOAST',
|
ADD_TOAST: 'ADD_TOAST',
|
||||||
@ -136,7 +138,7 @@ const dispatch = (action: Action) => {
|
|||||||
|
|
||||||
const toast = (props: ToasterToast) => {
|
const toast = (props: ToasterToast) => {
|
||||||
if (!props.duration) {
|
if (!props.duration) {
|
||||||
props.duration = 20000;
|
props.duration = 2000;
|
||||||
}
|
}
|
||||||
const id = genId();
|
const id = genId();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user