Commit e8d28615 authored by tom's avatar tom

clean-up

parent 436e889b
import type { UseToastOptions } from '@chakra-ui/react';
import type { UseToastOptions, ToastProps } from '@chakra-ui/react';
import { createToastFn, useChakra } from '@chakra-ui/react';
import React from 'react';
import Toast from 'ui/shared/Toast';
const defaultOptions = {
// there is no toastComponent prop in UseToastOptions type
// but these options will be passed to createRenderToast under the hood
// and it accepts custom toastComponent
const defaultOptions: UseToastOptions & { toastComponent?: React.FC<ToastProps> } = {
toastComponent: Toast,
position: 'top-right',
duration: 10000000,
......@@ -15,11 +18,7 @@ export default function useToastModified() {
const { theme } = useChakra();
return React.useMemo(
// there is no toastComponent prop in UseToastOptions type
// but these options will be passed to createRenderToast under the hood
// and it accepts custom toastComponent
// so we safely (I hope) do this type conversion
() => createToastFn(theme.direction, defaultOptions as UseToastOptions),
() => createToastFn(theme.direction, defaultOptions),
[ theme.direction ],
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment