mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
fix(SnackbarProvider): center alert
This commit is contained in:
1 parent
82adc9497b
commit
9ba8bd683f
2 files changed
+7
-8
No files matched your search
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import MuiAlert from '@material-ui/lab/Alert';
|
import MuiAlert from '@material-ui/lab/Alert';
|
||||||
|
|
||||||
export function Alert(props) {
|
export function Alert(props) {
|
||||||
return <MuiAlert elevation={6} variant='filled' {...props} />;
|
return <MuiAlert style={{ zIndex: 10000 }} elevation={6} variant='filled' {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Alert;
|
export default Alert;
|
||||||
@@ -6,17 +6,16 @@ import { ISnackbar } from '../interface/InterfaceUI';
|
|||||||
|
|
||||||
const useStyles = makeStyles(() => ({
|
const useStyles = makeStyles(() => ({
|
||||||
alert: {
|
alert: {
|
||||||
position: 'absolute',
|
marginTop: '-100px',
|
||||||
bottom: '15%',
|
display: 'flex',
|
||||||
right: '25%',
|
alignItems: 'center',
|
||||||
margin: '0 auto',
|
justifyContent: 'center'
|
||||||
textAlign: 'center'
|
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
export const SnackbarContext = createContext(null);
|
export const SnackbarContext = createContext(null);
|
||||||
const AUTO_HIDE = 1500;
|
const AUTO_HIDE = 2000;
|
||||||
|
|
||||||
function SnackbarProvider({ children }) {
|
function SnackbarProvider({ children }) {
|
||||||
const [alerts, setAlerts] = useState([]);
|
const [alerts, setAlerts] = useState([]);
|
||||||
@@ -39,7 +38,7 @@ function SnackbarProvider({ children }) {
|
|||||||
{children}
|
{children}
|
||||||
{alerts.map((alert: ISnackbar) => (
|
{alerts.map((alert: ISnackbar) => (
|
||||||
<div className={classes.alert}>
|
<div className={classes.alert}>
|
||||||
<Alert auto key={alert} severity="success" variant={alert.type}>
|
<Alert key={alert} severity={alert.type} variant="filled">
|
||||||
{alert.message}
|
{alert.message}
|
||||||
</Alert>
|
</Alert>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user