images
1 year ago
notification
9 months ago
query
1 year ago
state
1 year ago
index.js
1 year ago
index.scss
1 year ago
notification-icon.jsx
1 year ago
notifications-container.jsx
1 year ago
notifications.jsx
1 year ago
notification-icon.jsx
19 lines
| 1 | import { useWpchillState } from './state/use-wpchill-state'; |
| 2 | import { setShowContainer } from './state/actions'; |
| 3 | |
| 4 | export function NotificationIcon() { |
| 5 | const { state, dispatch } = useWpchillState(); |
| 6 | const { showContainer, visibleNotifications } = state; |
| 7 | const handleClick = () => { |
| 8 | dispatch( setShowContainer( showContainer ? false : true ) ); |
| 9 | }; |
| 10 | |
| 11 | return ( |
| 12 | <button className="notification-icon" onClick={ handleClick }> |
| 13 | <span className="warn-icon"> |
| 14 | { visibleNotifications.length } |
| 15 | </span> |
| 16 | </button> |
| 17 | ); |
| 18 | } |
| 19 |