Debian Codegraph @

node/@patternfly/react-core/src/components/NotificationBadge/examples/NotificationBadgeWithCount.tsx

raw
1 import { useState } from 'react';
2 import { NotificationBadge, NotificationBadgeVariant } from '@patternfly/react-core';
3
4 export const NotificationBadgeWithCount: React.FunctionComponent = () => {
5 const [readExpanded, setReadExpanded] = useState(false);
6 const [unreadExpanded, setUnreadExpanded] = useState(false);
7 const [attentionExpanded, setAttentionExpanded] = useState(false);
8
9 const onReadClick = () => {
10 setReadExpanded(!readExpanded);
11 };
12
13 const onUnreadClick = () => {
14 setUnreadExpanded(!unreadExpanded);
15 };
16
17 const onAttentionClick = () => {
18 setAttentionExpanded(!attentionExpanded);
19 };
20
21 return (
22 <>
23 <NotificationBadge
24 variant={NotificationBadgeVariant.read}
25 onClick={onReadClick}
26 aria-label="Notification badge with count and read variant"
27 isExpanded={readExpanded}
28 count={10}
29 />
30 <NotificationBadge
31 variant={NotificationBadgeVariant.unread}
32 onClick={onUnreadClick}
33 aria-label="Notification badge with count and unread variant"
34 isExpanded={unreadExpanded}
35 count={10}
36 />
37 <NotificationBadge
38 variant={NotificationBadgeVariant.attention}
39 onClick={onAttentionClick}
40 aria-label="Notification badge with count and attention variant"
41 isExpanded={attentionExpanded}
42 count={10}
43 />
44 </>
45 );
46 };