diff --git a/libs/remix-ui/toaster/src/lib/toaster.tsx b/libs/remix-ui/toaster/src/lib/toaster.tsx index fc13e8f6e3..0dfcacc078 100644 --- a/libs/remix-ui/toaster/src/lib/toaster.tsx +++ b/libs/remix-ui/toaster/src/lib/toaster.tsx @@ -64,11 +64,34 @@ export const Toaster = (props: ToasterProps) => { }) } + const handleMouseEnter = () => { + if (state.timeOutId) { + clearTimeout(state.timeOutId) + } + setState(prevState => { + return { ...prevState, timeOutId: null } + }) + } + + const handleMouseLeave = () => { + if (!state.timeOutId) { + const timeOutId = setTimeout(() => { + setState(prevState => { + return { ...prevState, hiding: true } + }) + }, state.timeOut) + + setState(prevState => { + return { ...prevState, timeOutId } + }) + } + } + return ( <> {/* */} { !state.hide && -
{ }} onMouseLeave={() => { }}> +
{ state.message } { (props.message.length > 201) && }