Commit 754128e9 authored by chenshouchao's avatar chenshouchao

feat: 修改提示信息默认显示时间

parent cd3761aa
...@@ -43,7 +43,7 @@ const getTransitionComponent = (transition: "grow" | "fade") => { ...@@ -43,7 +43,7 @@ const getTransitionComponent = (transition: "grow" | "fade") => {
const MySnackbarProvider = ({ const MySnackbarProvider = ({
vertical = "top", vertical = "top",
horizontal = "center", horizontal = "center",
autoHideDuration = 890000, autoHideDuration = 3000,
snackerClasses, snackerClasses,
ClickAwayListenerProps, ClickAwayListenerProps,
ContentProps, ContentProps,
...@@ -76,20 +76,20 @@ const MySnackbarProvider = ({ ...@@ -76,20 +76,20 @@ const MySnackbarProvider = ({
} = useMySnackbar(); } = useMySnackbar();
// .MuiAlert-filledInfo // .MuiAlert-filledInfo
const getColorStyle = useMemo(()=>{ const getColorStyle = useMemo(() => {
if(messageInfo.severity === 'success'){ if (messageInfo.severity === "success") {
return '#02AB83' return "#02AB83";
} }
if(messageInfo.severity === 'info'){ if (messageInfo.severity === "info") {
return '#1370FF' return "#1370FF";
} }
if(messageInfo.severity === 'warning'){ if (messageInfo.severity === "warning") {
return '#FFB919' return "#FFB919";
} }
if(messageInfo.severity === 'error'){ if (messageInfo.severity === "error") {
return '#FF4E4E' return "#FF4E4E";
} }
},[messageInfo.severity]) }, [messageInfo.severity]);
const theme = createTheme({ const theme = createTheme({
components: { components: {
...@@ -98,20 +98,17 @@ const MySnackbarProvider = ({ ...@@ -98,20 +98,17 @@ const MySnackbarProvider = ({
root: { root: {
color: getColorStyle, color: getColorStyle,
"& .MuiAlert-icon": { "& .MuiAlert-icon": {
color: getColorStyle color: getColorStyle,
},
}, },
}
}, },
}, },
}, },
}); });
return ( return (
<Fragment> <Fragment>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Snackbar <Snackbar
open={open} open={open}
autoHideDuration={autoHideDuration} autoHideDuration={autoHideDuration}
......
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