@@ -4,7 +4,7 @@ import { getNotificationIcon } from "./helpers";
44import moment from "moment" ;
55import { NotificationsPanelComponents as NPC } from "./styled" ;
66import React from "react" ;
7- import { Typography } from "@material-ui/core" ;
7+ import { ClickAwayListener , Typography } from "@material-ui/core" ;
88
99type Props = {
1010 handleClose : Function ,
@@ -13,35 +13,37 @@ type Props = {
1313
1414export const NotificationsPanel = ( { handleClose, notifications } : Props ) => {
1515 return (
16- < NPC . Container >
17- < NPC . Header >
18- < Typography variant = "caption" > Notifications</ Typography >
19- </ NPC . Header >
20- < NPC . Body >
21- { notifications . map ( n => (
22- < NPC . Item key = { n . created_at } onClick = { handleClose } >
23- { getNotificationIcon ( "foo" ) }
24- < div aria-label = "NotificationItem" >
25- < Typography variant = "body2" > { n . data . topic_title } </ Typography >
26- < Typography variant = "caption" >
27- { moment ( n . created_at ) . fromNow ( ) }
28- </ Typography >
29- </ div >
30- </ NPC . Item >
31- ) ) }
32- { notifications . length === 0 && (
33- < NPC . Item >
34- { getNotificationIcon ( "announcement" ) }
35- < div aria-label = "EmptyFeedback" >
36- < Typography variant = "body2" >
37- < i > There is not notifications yet</ i >
38- </ Typography >
39- </ div >
40- </ NPC . Item >
41- ) }
42- </ NPC . Body >
43- < NPC . Footer />
44- </ NPC . Container >
16+ < ClickAwayListener onClickAway = { handleClose } >
17+ < NPC . Container >
18+ < NPC . Header >
19+ < Typography variant = "caption" > Notifications</ Typography >
20+ </ NPC . Header >
21+ < NPC . Body >
22+ { notifications . map ( n => (
23+ < NPC . Item key = { n . created_at } onClick = { handleClose } >
24+ { getNotificationIcon ( "foo" ) }
25+ < div aria-label = "NotificationItem" >
26+ < Typography variant = "body2" > { n . data . topic_title } </ Typography >
27+ < Typography variant = "caption" >
28+ { moment ( n . created_at ) . fromNow ( ) }
29+ </ Typography >
30+ </ div >
31+ </ NPC . Item >
32+ ) ) }
33+ { notifications . length === 0 && (
34+ < NPC . Item >
35+ { getNotificationIcon ( "announcement" ) }
36+ < div aria-label = "EmptyFeedback" >
37+ < Typography variant = "body2" >
38+ < i > There is not notifications yet</ i >
39+ </ Typography >
40+ </ div >
41+ </ NPC . Item >
42+ ) }
43+ </ NPC . Body >
44+ < NPC . Footer />
45+ </ NPC . Container >
46+ </ ClickAwayListener >
4547 ) ;
4648} ;
4749
0 commit comments