@@ -11,21 +11,21 @@ import { forwardRef, useContext, useEffect, useState } from 'react';
1111import clsx from 'clsx' ;
1212
1313const IconWithBadge = forwardRef ( (
14- {
15- icon,
14+ {
15+ icon,
1616 onClick,
1717 className,
18- } : {
18+ } : {
1919 icon : IconDefinition ,
2020 onClick : ( ) => void ,
2121 className : string ,
22- } ,
22+ } ,
2323 ref : React . Ref < HTMLDivElement > ) => {
2424
2525 return (
26- < div ref = { ref } >
27- < FontAwesomeIcon icon = { icon } className = { className } onClick = { onClick } />
28- < div className = "absolute top-[3px] right-[0px ] h-2 w-2 rounded-full bg-red " />
26+ < div ref = { ref } onClick = { onClick } className = { className } >
27+ < FontAwesomeIcon icon = { icon } />
28+ < div className = "bg-red absolute right-[0px] top-[3px ] h-2 w-2 cursor-pointer rounded-full " />
2929 </ div >
3030 )
3131} ) ;
@@ -34,33 +34,33 @@ IconWithBadge.displayName = 'IconWithBadge';
3434
3535export const NotificationPopover = ( ) => {
3636 const { notifications, ongoingNotifications } = useContext ( NotificationContext ) ;
37- const [ newNotifications , setNewNotifications ] = useState < boolean > ( false ) ;
38- const [ previousNotifications , setPreviousNotifications ] = useState < NotificationItem [ ] > ( [ ] ) ;
37+ const [ newNotifications , setNewNotifications ] = useState < boolean > ( false ) ;
38+ const [ previousNotifications , setPreviousNotifications ] = useState < NotificationItem [ ] > ( [ ] ) ;
3939
4040 const shouldShowPopup = ( ) => {
41- return newNotifications ||
42- ongoingNotifications . length > 0 ||
41+ return newNotifications ||
42+ ongoingNotifications . length > 0 ||
4343 previousNotifications . map ( n => n . fresh && ! ( notifications . includes ( n ) ) ) . length > 0 ;
4444 } ;
4545
4646 useEffect ( ( ) => {
4747 setPreviousNotifications ( notifications ) ;
4848 setNewNotifications ( shouldShowPopup ( ) ) ;
4949 } , [ notifications , ongoingNotifications ] ) ;
50-
50+
5151
5252 return (
5353 < Popover className = "relative" >
5454 < Popover . Button
5555 as = { newNotifications ? IconWithBadge : FontAwesomeIcon }
5656 icon = { faBell }
5757 className = { clsx (
58- "w-4 select-none hover:cursor-pointer ui-open:text-gray-300 " ,
58+ "ui-open:text-gray-300 w-4 select-none hover:cursor-pointer" ,
5959 newNotifications ? "ui-not-open:text-white/75 ui-not-open:hover:text-white/90" :
60- "ui-not-open:text-white/50 ui-not-open:hover:text-white/75" ) }
60+ "ui-not-open:text-white/50 ui-not-open:hover:text-white/75" ) }
6161 onClick = { ( ) => newNotifications && setNewNotifications ( false ) }
6262 />
63- < Popover . Panel className = "absolute right-0 z-40 mt-1 h-[80vh] w-[480px] rounded-lg drop-shadow-lg child:h-full " >
63+ < Popover . Panel className = "child:h-full absolute right-0 z-40 mt-1 h-[80vh] w-[480px] rounded-lg drop-shadow-lg" >
6464 < NotificationPanel className = "rounded-lg border" />
6565 </ Popover . Panel >
6666 </ Popover >
0 commit comments