import React from 'react'; import { Grid, withStyles } from '@material-ui/core'; import { Close as CloseIcon } from '@material-ui/icons'; import classnames from 'classnames'; import { ToastContainer } from 'react-toastify'; import SyntaxHighlighter from 'react-syntax-highlighter'; import { docco } from 'react-syntax-highlighter/dist/esm/styles/hljs'; import tinycolor from 'tinycolor2'; import 'react-toastify/dist/ReactToastify.css'; import Widget from '../../components/Widget'; import PageTitle from '../../components/PageTitle'; import NotificationCustomComponent from '../../components/Notification'; import { Typography, Button } from '../../components/Wrappers'; const CloseButton = ({ closeToast, className }) => ( ); const NotificationsPage = ({ classes, ...props}) => ( } closeOnClick={false} progressClassName={classes.notificationProgress} /> There are few position options available for notifications. You can click any of them to change notifications position:
Click any position
Different types of notifications for lost of use cases. Custom classes are also supported.
Notifications are created with the help of react-toastify
{` // import needed components, functions and styles import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; const Page = () => {
}; `}
For more API information refer to the library documentation
); const styles = (theme) => ({ layoutContainer: { height: 200, display: 'flex', flexDirection: 'column', justifyContent: 'space-between', alignItems: 'center', marginTop: theme.spacing.unit * 2, border: '1px dashed', borderColor: theme.palette.primary.main, position: 'relative', }, layoutText: { color: tinycolor(theme.palette.background.light).darken().toHexString(), }, layoutButtonsRow: { width: '100%', display: 'flex', justifyContent: 'space-between', }, layoutButton: { backgroundColor: theme.palette.background.light, width: 125, height: 50, outline: 'none', border: 'none', }, layoutButtonActive: { backgroundColor: tinycolor(theme.palette.background.light).darken().toHexString(), }, buttonsContainer: { display: 'flex', flexDirection: 'column', alignItems: 'flex-start', marginTop: theme.spacing.unit * 2, }, notificationCallButton: { color: 'white', marginBottom: theme.spacing.unit, textTransform: 'none', }, codeContainer: { display: 'flex', flexDirection: 'column', marginTop: theme.spacing.unit * 2, }, codeComponent: { flexGrow: 1, }, notificationItem: { marginTop: theme.spacing.unit * 2, }, notificationCloseButton: { position: 'absolute', right: theme.spacing.unit * 2, }, toastsContainer: { width: 400, marginTop: theme.spacing.unit * 6, right: 0, } }); export default withStyles(styles, { withTheme: true})(NotificationsPage);