first commit
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import React from "react";
|
||||
import Card from "@mui/material/Card";
|
||||
import { Typography } from "@mui/material";
|
||||
import Button from '@mui/material/Button';
|
||||
import { SnackbarProvider, useSnackbar } from 'notistack';
|
||||
|
||||
function MyApp() {
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const handleClick = () => {
|
||||
enqueueSnackbar('I love snacks.');
|
||||
};
|
||||
|
||||
const handleClickVariant = (variant) => () => {
|
||||
// variant could be success, error, warning, info, or default
|
||||
enqueueSnackbar('This is a success message!', { variant });
|
||||
};
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Button onClick={handleClick}>Show snackbar</Button>
|
||||
<Button onClick={handleClickVariant('success')}>Show success snackbar</Button>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ComplementaryProjects() {
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
sx={{
|
||||
boxShadow: "none",
|
||||
borderRadius: "10px",
|
||||
p: "25px",
|
||||
mb: "15px",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
as="h3"
|
||||
sx={{
|
||||
fontSize: 18,
|
||||
fontWeight: 500,
|
||||
mb: '10px'
|
||||
}}
|
||||
>
|
||||
Complementary Projects
|
||||
</Typography>
|
||||
|
||||
<SnackbarProvider maxSnack={3}>
|
||||
<MyApp />
|
||||
</SnackbarProvider>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import React from "react";
|
||||
import Card from "@mui/material/Card";
|
||||
import { Typography } from "@mui/material";
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Button from '@mui/material/Button';
|
||||
import Snackbar from '@mui/material/Snackbar';
|
||||
import MuiAlert from '@mui/material/Alert';
|
||||
|
||||
const Alert = React.forwardRef(function Alert(props, ref) {
|
||||
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
|
||||
});
|
||||
|
||||
export default function Customization() {
|
||||
|
||||
const [open, setOpen] = React.useState(false);
|
||||
|
||||
const handleClick = () => {
|
||||
setOpen(true);
|
||||
};
|
||||
|
||||
const handleClose = (event, reason) => {
|
||||
if (reason === 'clickaway') {
|
||||
return;
|
||||
}
|
||||
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
sx={{
|
||||
boxShadow: "none",
|
||||
borderRadius: "10px",
|
||||
p: "25px",
|
||||
mb: "15px",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
as="h3"
|
||||
sx={{
|
||||
fontSize: 18,
|
||||
fontWeight: 500,
|
||||
mb: '10px'
|
||||
}}
|
||||
>
|
||||
Customization
|
||||
</Typography>
|
||||
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Button variant="outlined" onClick={handleClick}>
|
||||
Open success snackbar
|
||||
</Button>
|
||||
|
||||
<Snackbar open={open} autoHideDuration={5000} onClose={handleClose}>
|
||||
<Alert onClose={handleClose} severity="success" sx={{ width: '100%' }}>
|
||||
This is a success message!
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
|
||||
<Alert severity="error">This is an error message!</Alert>
|
||||
|
||||
<Alert severity="warning">This is a warning message!</Alert>
|
||||
|
||||
<Alert severity="info">This is an information message!</Alert>
|
||||
|
||||
<Alert severity="success">This is a success message!</Alert>
|
||||
</Stack>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import React from "react";
|
||||
import Card from "@mui/material/Card";
|
||||
import { Typography } from "@mui/material";
|
||||
import Button from '@mui/material/Button';
|
||||
import Snackbar from '@mui/material/Snackbar';
|
||||
|
||||
export default function PositionedSnackbars() {
|
||||
|
||||
const [state, setState] = React.useState({
|
||||
open: false,
|
||||
vertical: 'top',
|
||||
horizontal: 'center',
|
||||
});
|
||||
const { vertical, horizontal, open } = state;
|
||||
|
||||
const handleClick = (newState) => () => {
|
||||
setState({ open: true, ...newState });
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setState({ ...state, open: false });
|
||||
};
|
||||
|
||||
const buttons = (
|
||||
<React.Fragment>
|
||||
<Button
|
||||
onClick={handleClick({
|
||||
vertical: 'top',
|
||||
horizontal: 'center',
|
||||
})}
|
||||
>
|
||||
Top-Center
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleClick({
|
||||
vertical: 'top',
|
||||
horizontal: 'right',
|
||||
})}
|
||||
>
|
||||
Top-Right
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleClick({
|
||||
vertical: 'bottom',
|
||||
horizontal: 'right',
|
||||
})}
|
||||
>
|
||||
Bottom-Right
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleClick({
|
||||
vertical: 'bottom',
|
||||
horizontal: 'center',
|
||||
})}
|
||||
>
|
||||
Bottom-Center
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleClick({
|
||||
vertical: 'bottom',
|
||||
horizontal: 'left',
|
||||
})}
|
||||
>
|
||||
Bottom-Left
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleClick({
|
||||
vertical: 'top',
|
||||
horizontal: 'left',
|
||||
})}
|
||||
>
|
||||
Top-Left
|
||||
</Button>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
sx={{
|
||||
boxShadow: "none",
|
||||
borderRadius: "10px",
|
||||
p: "25px",
|
||||
mb: "15px",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
as="h3"
|
||||
sx={{
|
||||
fontSize: 18,
|
||||
fontWeight: 500,
|
||||
mb: '10px'
|
||||
}}
|
||||
>
|
||||
Positioned Snackbars
|
||||
</Typography>
|
||||
|
||||
<div>
|
||||
{buttons}
|
||||
<Snackbar
|
||||
anchorOrigin={{ vertical, horizontal }}
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
message="I love snacks"
|
||||
key={vertical + horizontal}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import React from "react";
|
||||
import Card from "@mui/material/Card";
|
||||
import { Typography } from "@mui/material";
|
||||
import Button from '@mui/material/Button';
|
||||
import Snackbar from '@mui/material/Snackbar';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
|
||||
export default function SimpleSnackbars() {
|
||||
|
||||
const [open, setOpen] = React.useState(false);
|
||||
|
||||
const handleClick = () => {
|
||||
setOpen(true);
|
||||
};
|
||||
|
||||
const handleClose = (event, reason) => {
|
||||
if (reason === 'clickaway') {
|
||||
return;
|
||||
}
|
||||
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const action = (
|
||||
<React.Fragment>
|
||||
<Button color="secondary" size="small" onClick={handleClose}>
|
||||
UNDO
|
||||
</Button>
|
||||
<IconButton
|
||||
size="small"
|
||||
aria-label="close"
|
||||
color="inherit"
|
||||
onClick={handleClose}
|
||||
>
|
||||
<CloseIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
sx={{
|
||||
boxShadow: "none",
|
||||
borderRadius: "10px",
|
||||
p: "25px",
|
||||
mb: "15px",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
as="h3"
|
||||
sx={{
|
||||
fontSize: 18,
|
||||
fontWeight: 500,
|
||||
mb: '15px'
|
||||
}}
|
||||
>
|
||||
Simple Snackbars
|
||||
</Typography>
|
||||
|
||||
<>
|
||||
<Button onClick={handleClick} variant="contained" color="primary" size="large" className="whiteColor">
|
||||
Open simple snackbar
|
||||
</Button>
|
||||
<Snackbar
|
||||
open={open}
|
||||
autoHideDuration={5000}
|
||||
onClose={handleClose}
|
||||
message="Note archived"
|
||||
action={action}
|
||||
/>
|
||||
</>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user