automatisch / packages /web /src /hooks /useEnqueueSnackbar.js
musarehmani100's picture
Upload folder using huggingface_hub
3206347 verified
import { useSnackbar } from 'notistack';
export default function useEnqueueSnackbar() {
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
return function wrappedEnqueueSnackbar(message, options) {
const key = enqueueSnackbar(message, {
...(options || {}),
SnackbarProps: {
onClick: () => closeSnackbar(key),
...{
'data-test': 'snackbar',
'data-snackbar-variant': `${options.variant}` || 'default',
},
...(options.SnackbarProps || {}),
},
});
return key;
};
}