mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-31 19:12:46 +00:00
Some checks failed
Deploy doc image by kubeconfig / build-fastgpt-docs-images (push) Has been cancelled
Deploy doc image to vercel / deploy-production (push) Has been cancelled
Build FastGPT images in Personal warehouse / build-fastgpt-images (push) Has been cancelled
Deploy doc image by kubeconfig / update-docs-image (push) Has been cancelled
* adjust toast top distance * save button top
30 lines
656 B
TypeScript
30 lines
656 B
TypeScript
import { useToast as uToast, UseToastOptions } from '@chakra-ui/react';
|
|
import { CSSProperties, useCallback } from 'react';
|
|
|
|
export const useToast = (props?: UseToastOptions & { containerStyle?: CSSProperties }) => {
|
|
const { containerStyle, ...toastProps } = props || {};
|
|
|
|
const toast = uToast({
|
|
position: 'top',
|
|
duration: 2000,
|
|
containerStyle: {
|
|
fontSize: 'sm',
|
|
...containerStyle
|
|
},
|
|
...toastProps
|
|
});
|
|
|
|
const myToast = useCallback(
|
|
(options?: UseToastOptions) => {
|
|
if (options?.title || options?.description) {
|
|
toast(options);
|
|
}
|
|
},
|
|
[props]
|
|
);
|
|
|
|
return {
|
|
toast: myToast
|
|
};
|
|
};
|