Debian Codegraph @

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

raw
1 import { useState } from 'react';
2 import { NotificationBadge, NotificationBadgeVariant } from '@patternfly/react-core';
3
4 export const NotificationBadgeBasic: 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="Basic notification badge with read variant"
27 isExpanded={readExpanded}
28 />
29 <NotificationBadge
30 variant={NotificationBadgeVariant.unread}
31 onClick={onUnreadClick}
32 aria-label="Basic notification badge with unread variant"
33 isExpanded={unreadExpanded}
34 />
35 <NotificationBadge
36 variant={NotificationBadgeVariant.attention}
37 onClick={onAttentionClick}
38 aria-label="Basic notification badge with attention variant"
39 isExpanded={attentionExpanded}
40 />
41 </>
42 );
43 };