diff --git a/src/components/Notification/Notification.js b/src/components/Notification/Notification.js
index 8b39fe4..44dc904 100644
--- a/src/components/Notification/Notification.js
+++ b/src/components/Notification/Notification.js
@@ -13,7 +13,7 @@ import {
Error as DefenceIcon,
AccountBox as CustomerIcon,
Done as ShippedIcon,
- Publish as UploadIcon,
+ Publish as UploadIcon
} from "@material-ui/icons";
import { useTheme } from "@material-ui/styles";
import classnames from "classnames";
@@ -38,7 +38,7 @@ const typesIcons = {
defence: ,
report: ,
upload: ,
- disc: ,
+ disc:
};
export default function Notification({ variant, ...props }) {
@@ -48,33 +48,33 @@ export default function Notification({ variant, ...props }) {
const icon = getIconByType(props.type);
const iconWithStyles = React.cloneElement(icon, {
classes: {
- root: classes.notificationIcon,
+ root: classes.notificationIcon
},
style: {
color:
variant !== "contained" &&
theme.palette[props.color] &&
- theme.palette[props.color].main,
- },
+ theme.palette[props.color].main
+ }
});
return (
{iconWithStyles}
@@ -90,7 +90,7 @@ export default function Notification({ variant, ...props }) {
-
-
-
-
-
- There are few position options available for notifications. You
- can click any of them to change notifications position:
-
-
-
- changeNotificationPosition(0)}
- className={classnames(classes.layoutButton, {
- [classes.layoutButtonActive]: notificationsPosition === 0,
- })}
- />
- changeNotificationPosition(1)}
- className={classnames(classes.layoutButton, {
- [classes.layoutButtonActive]: notificationsPosition === 1,
- })}
- />
- changeNotificationPosition(2)}
- className={classnames(classes.layoutButton, {
- [classes.layoutButtonActive]: notificationsPosition === 2,
- })}
- />
-
-
- Click any position
-
-
- changeNotificationPosition(3)}
- className={classnames(classes.layoutButton, {
- [classes.layoutButtonActive]: notificationsPosition === 3,
- })}
- />
- changeNotificationPosition(4)}
- className={classnames(classes.layoutButton, {
- [classes.layoutButtonActive]: notificationsPosition === 4,
- })}
- />
- changeNotificationPosition(5)}
- className={classnames(classes.layoutButton, {
- [classes.layoutButtonActive]: notificationsPosition === 5,
- })}
- />
-
-
-
-
-
-
-
- Different types of notifications for lost of use cases. Custom
- classes are also supported.
-
-
- handleNotificationCall("info")}
- className={classnames(classes.notificationCallButton)}
- >
- Info Message
-
- handleNotificationCall("error")}
- className={classnames(classes.notificationCallButton)}
- >
- Error + Retry Message
-
- handleNotificationCall("success")}
- className={classnames(classes.notificationCallButton)}
- >
- Success Message
-
-
-
-
-
-
-
- Notifications are created with the help of{" "}
-
- react-toastify
-
-
-
-
{`
+
+
+
+
+
+ There are few position options available for notifications.
+ You can click any of them to change notifications position:
+
+
+
+ changeNotificationPosition(0)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ notificationsPosition === 0
+ })}
+ />
+ changeNotificationPosition(1)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ notificationsPosition === 1
+ })}
+ />
+ changeNotificationPosition(2)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ notificationsPosition === 2
+ })}
+ />
+
+
+ Click any position
+
+
+ changeNotificationPosition(3)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ notificationsPosition === 3
+ })}
+ />
+ changeNotificationPosition(4)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ notificationsPosition === 4
+ })}
+ />
+ changeNotificationPosition(5)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ notificationsPosition === 5
+ })}
+ />
+
+
+
+
+
+
+
+ Different types of notifications for lost of use cases.
+ Custom classes are also supported.
+
+
+ handleNotificationCall("info")}
+ className={classnames(classes.notificationCallButton)}
+ >
+ Info Message
+
+ handleNotificationCall("error")}
+ className={classnames(classes.notificationCallButton)}
+ >
+ Error + Retry Message
+
+ handleNotificationCall("success")}
+ className={classnames(classes.notificationCallButton)}
+ >
+ Success Message
+
+
+
+
+
+
+
+ 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';
@@ -161,13 +191,14 @@ export default function NotificationsPage(props) {
};
`}
-
- For more API information refer to the library documentation
-
-
-
+
+ For more API information refer to the library
+ documentation
+
+
+
+
-
@@ -319,7 +350,7 @@ export default function NotificationsPage(props) {
{...componentProps}
className={classes.notificationComponent}
/>,
- options,
+ options
);
}
@@ -328,11 +359,11 @@ export default function NotificationsPage(props) {
type: "message",
message: "Message was sent successfully!",
variant: "contained",
- color: "success",
+ color: "success"
};
toast.update(errorToastId, {
render: ,
- type: "success",
+ type: "success"
});
setErrorToastId(null);
}
@@ -348,7 +379,7 @@ export default function NotificationsPage(props) {
type: "feedback",
message: "New user feedback received",
variant: "contained",
- color: "primary",
+ color: "primary"
};
break;
case "error":
@@ -358,7 +389,7 @@ export default function NotificationsPage(props) {
variant: "contained",
color: "secondary",
extraButton: "Resend",
- extraButtonClick: retryErrorNotification,
+ extraButtonClick: retryErrorNotification
};
break;
default:
@@ -366,7 +397,7 @@ export default function NotificationsPage(props) {
type: "shipped",
message: "The item was shipped",
variant: "contained",
- color: "success",
+ color: "success"
};
}
@@ -375,7 +406,7 @@ export default function NotificationsPage(props) {
position: positions[notificationsPosition],
progressClassName: classes.progress,
onClose: notificationType === "error" && (() => setErrorToastId(null)),
- className: classes.notification,
+ className: classes.notification
});
if (notificationType === "error") setErrorToastId(toastId);
@@ -386,7 +417,6 @@ export default function NotificationsPage(props) {
}
}
-// #############################################################
function CloseButton({ closeToast, className }) {
return ;
}
diff --git a/src/pages/notifications/NotificationsContainer.js b/src/pages/notifications/NotificationsContainer.js
index 44de4c2..7c666a6 100644
--- a/src/pages/notifications/NotificationsContainer.js
+++ b/src/pages/notifications/NotificationsContainer.js
@@ -16,7 +16,7 @@ const positions = [
];
export default compose(
- withStyles(theme => ({
+ withStyles((theme) => ({
/*progress: {
visibility: "hidden"
},
@@ -34,7 +34,7 @@ export default compose(
withState("notificationsPosition", "setNotificationPosition", 2),
withState("errorToastId", "setErrorToastId", null),
withHandlers({
- sendNotification: props => (componentProps, options) => {
+ sendNotification: (props) => (componentProps, options) => {
return toast(
() => {
+ retryErrorNotification: (props) => () => {
const componentProps = {
type: "message",
message: "Message was sent successfully!",
variant: "contained",
- color: "success",
+ color: "success"
};
toast.update(props.errorToastId, {
@@ -61,7 +61,7 @@ export default compose(
}
}),
withHandlers({
- handleNotificationCall: props => notificationType => {
+ handleNotificationCall: (props) => (notificationType) => {
let componentProps;
if (props.errorToastId && notificationType === "error") return;
@@ -105,7 +105,7 @@ export default compose(
if (notificationType === "error") props.setErrorToastId(toastId);
},
- changeNotificationPosition: props => positionId => {
+ changeNotificationPosition: (props) => (positionId) => {
props.setNotificationPosition(positionId);
}
})
diff --git a/src/pages/notifications/NotificationsView.js b/src/pages/notifications/NotificationsView.js
index cce42e6..df844b3 100644
--- a/src/pages/notifications/NotificationsView.js
+++ b/src/pages/notifications/NotificationsView.js
@@ -1,63 +1,141 @@
-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 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';
+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}) => (
+const NotificationsPage = ({ classes, ...props }) => (
- } closeOnClick={false} progressClassName={classes.notificationProgress} />
+
+ }
+ closeOnClick={false}
+ progressClassName={classes.notificationProgress}
+ />
- There are few position options available for notifications. You can click any of them to change notifications position:
+
+ There are few position options available for notifications. You can
+ click any of them to change notifications position:
+
- props.changeNotificationPosition(0)} className={classnames(classes.layoutButton, { [classes.layoutButtonActive]: props.notificationsPosition === 0})} />
- props.changeNotificationPosition(1)} className={classnames(classes.layoutButton, { [classes.layoutButtonActive]: props.notificationsPosition === 1})} />
- props.changeNotificationPosition(2)} className={classnames(classes.layoutButton, { [classes.layoutButtonActive]: props.notificationsPosition === 2})} />
+ props.changeNotificationPosition(0)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ props.notificationsPosition === 0
+ })}
+ />
+ props.changeNotificationPosition(1)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ props.notificationsPosition === 1
+ })}
+ />
+ props.changeNotificationPosition(2)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ props.notificationsPosition === 2
+ })}
+ />
-
Click any position
+
+ Click any position
+
- props.changeNotificationPosition(3)} className={classnames(classes.layoutButton, { [classes.layoutButtonActive]: props.notificationsPosition === 3})} />
- props.changeNotificationPosition(4)} className={classnames(classes.layoutButton, { [classes.layoutButtonActive]: props.notificationsPosition === 4})} />
- props.changeNotificationPosition(5)} className={classnames(classes.layoutButton, { [classes.layoutButtonActive]: props.notificationsPosition === 5})} />
+ props.changeNotificationPosition(3)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ props.notificationsPosition === 3
+ })}
+ />
+ props.changeNotificationPosition(4)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ props.notificationsPosition === 4
+ })}
+ />
+ props.changeNotificationPosition(5)}
+ className={classnames(classes.layoutButton, {
+ [classes.layoutButtonActive]:
+ props.notificationsPosition === 5
+ })}
+ />
- Different types of notifications for lost of use cases. Custom classes are also supported.
+
+ Different types of notifications for lost of use cases. Custom
+ classes are also supported.
+
- props.handleNotificationCall('info')} className={classnames(classes.notificationCallButton)}>Info Message
- props.handleNotificationCall('error')} className={classnames(classes.notificationCallButton)}>Error + Retry Message
- props.handleNotificationCall('success')} className={classnames(classes.notificationCallButton)}>Success Message
+ props.handleNotificationCall("info")}
+ className={classnames(classes.notificationCallButton)}
+ >
+ Info Message
+
+ props.handleNotificationCall("error")}
+ className={classnames(classes.notificationCallButton)}
+ >
+ Error + Retry Message
+
+ props.handleNotificationCall("success")}
+ className={classnames(classes.notificationCallButton)}
+ >
+ Success Message
+
- Notifications are created with the help of react-toastify
+
+ 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';
@@ -71,38 +149,148 @@ const NotificationsPage = ({ classes, ...props}) => (
};
`}
- For more API information refer to the library documentation
+
+ For more API information refer to the library documentation
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -112,64 +300,66 @@ const NotificationsPage = ({ classes, ...props}) => (
const styles = (theme) => ({
layoutContainer: {
height: 200,
- display: 'flex',
- flexDirection: 'column',
- justifyContent: 'space-between',
- alignItems: 'center',
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "space-between",
+ alignItems: "center",
marginTop: theme.spacing.unit * 2,
- border: '1px dashed',
+ border: "1px dashed",
borderColor: theme.palette.primary.main,
- position: 'relative',
+ position: "relative"
},
layoutText: {
- color: tinycolor(theme.palette.background.light).darken().toHexString(),
+ color: tinycolor(theme.palette.background.light).darken().toHexString()
},
layoutButtonsRow: {
- width: '100%',
- display: 'flex',
- justifyContent: 'space-between',
+ width: "100%",
+ display: "flex",
+ justifyContent: "space-between"
},
layoutButton: {
backgroundColor: theme.palette.background.light,
width: 125,
height: 50,
- outline: 'none',
- border: 'none',
+ outline: "none",
+ border: "none"
},
layoutButtonActive: {
- backgroundColor: tinycolor(theme.palette.background.light).darken().toHexString(),
+ backgroundColor: tinycolor(theme.palette.background.light)
+ .darken()
+ .toHexString()
},
buttonsContainer: {
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'flex-start',
- marginTop: theme.spacing.unit * 2,
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "flex-start",
+ marginTop: theme.spacing.unit * 2
},
notificationCallButton: {
- color: 'white',
+ color: "white",
marginBottom: theme.spacing.unit,
- textTransform: 'none',
+ textTransform: "none"
},
codeContainer: {
- display: 'flex',
- flexDirection: 'column',
- marginTop: theme.spacing.unit * 2,
+ display: "flex",
+ flexDirection: "column",
+ marginTop: theme.spacing.unit * 2
},
codeComponent: {
- flexGrow: 1,
+ flexGrow: 1
},
notificationItem: {
- marginTop: theme.spacing.unit * 2,
+ marginTop: theme.spacing.unit * 2
},
notificationCloseButton: {
- position: 'absolute',
- right: theme.spacing.unit * 2,
+ position: "absolute",
+ right: theme.spacing.unit * 2
},
toastsContainer: {
width: 400,
marginTop: theme.spacing.unit * 6,
- right: 0,
+ right: 0
}
});
-export default withStyles(styles, { withTheme: true})(NotificationsPage);
+export default withStyles(styles, { withTheme: true })(NotificationsPage);
diff --git a/src/pages/notifications/styles.js b/src/pages/notifications/styles.js
index 9bde828..9d47b8a 100644
--- a/src/pages/notifications/styles.js
+++ b/src/pages/notifications/styles.js
@@ -1,7 +1,7 @@
import { makeStyles } from "@material-ui/styles";
import tinycolor from "tinycolor2";
-export default makeStyles(theme => ({
+export default makeStyles((theme) => ({
layoutContainer: {
height: 200,
display: "flex",
@@ -11,73 +11,71 @@ export default makeStyles(theme => ({
marginTop: theme.spacing(2),
border: "1px dashed",
borderColor: theme.palette.primary.main,
- position: "relative",
+ position: "relative"
},
layoutText: {
- color: tinycolor(theme.palette.background.light)
- .darken()
- .toHexString(),
+ color: tinycolor(theme.palette.background.light).darken().toHexString()
},
layoutButtonsRow: {
width: "100%",
display: "flex",
- justifyContent: "space-between",
+ justifyContent: "space-between"
},
layoutButton: {
backgroundColor: theme.palette.background.light,
width: 125,
height: 50,
outline: "none",
- border: "none",
+ border: "none"
},
layoutButtonActive: {
backgroundColor: tinycolor(theme.palette.background.light)
.darken()
- .toHexString(),
+ .toHexString()
},
buttonsContainer: {
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
- marginTop: theme.spacing(2),
+ marginTop: theme.spacing(2)
},
notificationCallButton: {
color: "white",
marginBottom: theme.spacing(1),
- textTransform: "none",
+ textTransform: "none"
},
codeContainer: {
display: "flex",
flexDirection: "column",
- marginTop: theme.spacing(2),
+ marginTop: theme.spacing(2)
},
codeComponent: {
- flexGrow: 1,
+ flexGrow: 1
},
notificationItem: {
- marginTop: theme.spacing(2),
+ marginTop: theme.spacing(2)
},
notificationCloseButton: {
position: "absolute",
- right: theme.spacing(2),
+ right: theme.spacing(2)
},
toastsContainer: {
width: 400,
marginTop: theme.spacing(6),
- right: 0,
+ right: 0
},
progress: {
- visibility: "hidden",
+ visibility: "hidden"
},
notification: {
display: "flex",
alignItems: "center",
background: "transparent",
boxShadow: "none",
- overflow: "visible",
+ overflow: "visible"
},
notificationComponent: {
- paddingRight: theme.spacing(4),
+ paddingRight: theme.spacing(4)
},
widgetHeader: {
paddingBottom: 8