-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.jsx
41 lines (34 loc) · 1.05 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, { useState, useEffect } from "react";
import { useHistory } from "react-router-dom";
import Dialog from "@material-ui/core/Dialog";
import { GET_PARAMS } from "~/const/router";
import useGetParameter from "~/hooks/router/useGetParameter";
import NotificationsList from "./NotificationsList";
import NotificationDetails from "./NotificationDetails";
import useStyles from "./styles";
const Notifications = ({ isOpened }) => {
const notificationId = useGetParameter(GET_PARAMS.notificationId);
const history = useHistory();
const [id, setId] = useState(notificationId);
const styles = useStyles();
useEffect(() => {
if (notificationId) {
setId(notificationId);
}
}, [notificationId]);
return (
<Dialog
onClose={history.goBack}
open={Boolean(isOpened)}
classes={{
paperWidthSm: styles.dialog
}}
>
<div className={styles.container}>
<NotificationsList />
{id && <NotificationDetails notificationId={id} />}
</div>
</Dialog>
);
};
export default Notifications;