| 1 |
import { Fragment, useRef, useState } from 'react'; |
| 2 |
import { |
| 3 |
Avatar, |
| 4 |
Brand, |
| 5 |
Breadcrumb, |
| 6 |
BreadcrumbItem, |
| 7 |
Button, |
| 8 |
ButtonVariant, |
| 9 |
Content, |
| 10 |
Divider, |
| 11 |
Dropdown, |
| 12 |
DropdownItem, |
| 13 |
DropdownList, |
| 14 |
EmptyState, |
| 15 |
EmptyStateActions, |
| 16 |
EmptyStateBody, |
| 17 |
EmptyStateFooter, |
| 18 |
EmptyStateVariant, |
| 19 |
MenuToggle, |
| 20 |
Nav, |
| 21 |
NavItem, |
| 22 |
NavList, |
| 23 |
NotificationBadge, |
| 24 |
NotificationDrawer, |
| 25 |
NotificationDrawerBody, |
| 26 |
NotificationDrawerHeader, |
| 27 |
NotificationDrawerList, |
| 28 |
NotificationDrawerListItem, |
| 29 |
NotificationDrawerListItemBody, |
| 30 |
NotificationDrawerListItemHeader, |
| 31 |
Page, |
| 32 |
PageSection, |
| 33 |
PageSidebar, |
| 34 |
PageSidebarBody, |
| 35 |
SkipToContent, |
| 36 |
PageToggleButton, |
| 37 |
Masthead, |
| 38 |
MastheadMain, |
| 39 |
MastheadBrand, |
| 40 |
MastheadToggle, |
| 41 |
MastheadContent, |
| 42 |
MastheadLogo, |
| 43 |
Toolbar, |
| 44 |
ToolbarItem, |
| 45 |
ToolbarGroup, |
| 46 |
ToolbarContent |
| 47 |
} from '@patternfly/react-core'; |
| 48 |
import RhUiSettingsFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-settings-fill-icon'; |
| 49 |
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'; |
| 50 |
import RhUiQuestionMarkCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-fill-icon'; |
| 51 |
import RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon'; |
| 52 |
import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg'; |
| 53 |
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon'; |
| 54 |
import pfLogo from '@patternfly/react-core/src/demos/assets/pf-logo.PF-HorizontalLogo-Color.svg'; |
| 55 |
|
| 56 |
export const NotificationDrawerBasic: React.FunctionComponent = () => { |
| 57 |
const drawerRef = useRef<HTMLElement | null>(null); |
| 58 |
|
| 59 |
const [isDropdownOpen, setIsDropdownOpen] = useState(false); |
| 60 |
const [isKebabDropdownOpen, setIsKebabDropdownOpen] = useState(false); |
| 61 |
const [isDrawerExpanded, setIsDrawerExpanded] = useState(false); |
| 62 |
|
| 63 |
interface UnreadMap { |
| 64 |
[notificationId: string]: boolean; |
| 65 |
} |
| 66 |
|
| 67 |
const [activeItem, setActiveItem] = useState<number | string>(0); |
| 68 |
const [isUnreadMap, setIsUnreadMap] = useState<UnreadMap | null>({ |
| 69 |
'notification-1': true, |
| 70 |
'notification-2': true, |
| 71 |
'notification-3': false, |
| 72 |
'notification-4': false |
| 73 |
}); |
| 74 |
|
| 75 |
const [shouldShowNotifications, setShouldShowNotifications] = useState(true); |
| 76 |
|
| 77 |
interface ActionsMenu { |
| 78 |
[toggleId: string]: boolean; |
| 79 |
} |
| 80 |
|
| 81 |
const [isActionsMenuOpen, setIsActionsMenuOpen] = useState<ActionsMenu | {}>({}); |
| 82 |
|
| 83 |
const onNavSelect = ( |
| 84 |
_event: React.FormEvent<HTMLInputElement>, |
| 85 |
selectedItem: { |
| 86 |
groupId: number | string; |
| 87 |
itemId: number | string; |
| 88 |
to: string; |
| 89 |
} |
| 90 |
) => setActiveItem(selectedItem.itemId); |
| 91 |
|
| 92 |
const onDropdownToggle = () => setIsDropdownOpen((prevState) => !prevState); |
| 93 |
const onDropdownSelect = () => setIsDropdownOpen(false); |
| 94 |
const onKebabDropdownToggle = () => setIsKebabDropdownOpen((prevState) => !prevState); |
| 95 |
const onKebabDropdownSelect = () => setIsKebabDropdownOpen(false); |
| 96 |
const onCloseNotificationDrawer = (_event: any) => setIsDrawerExpanded((prevState) => !prevState); |
| 97 |
|
| 98 |
const onToggle = (id: string) => { |
| 99 |
setIsActionsMenuOpen({ [id]: !isActionsMenuOpen[id] }); |
| 100 |
}; |
| 101 |
|
| 102 |
const closeActionsMenu = () => setIsActionsMenuOpen({}); |
| 103 |
|
| 104 |
const onListItemClick = (id: string) => { |
| 105 |
if (!isUnreadMap) { |
| 106 |
return; |
| 107 |
} |
| 108 |
setIsUnreadMap({ ...isUnreadMap, [id]: false }); |
| 109 |
}; |
| 110 |
|
| 111 |
const getNumberUnread: () => number = () => { |
| 112 |
if (!isUnreadMap) { |
| 113 |
return 0; |
| 114 |
} |
| 115 |
return Object.values(isUnreadMap).reduce((count, value) => count + (value ? 1 : 0), 0); |
| 116 |
}; |
| 117 |
|
| 118 |
const markAllRead = () => setIsUnreadMap(null); |
| 119 |
|
| 120 |
const showNotifications = (showNotifications: boolean) => { |
| 121 |
setIsUnreadMap(null); |
| 122 |
setShouldShowNotifications(showNotifications); |
| 123 |
}; |
| 124 |
|
| 125 |
const focusDrawer = (_event: any) => { |
| 126 |
if (drawerRef.current === null) { |
| 127 |
return; |
| 128 |
} |
| 129 |
const firstTabbableItem = drawerRef.current.querySelector('a, button') as |
| 130 |
| HTMLAnchorElement |
| 131 |
| HTMLButtonElement |
| 132 |
| null; |
| 133 |
firstTabbableItem?.focus(); |
| 134 |
}; |
| 135 |
|
| 136 |
const PageNav = ( |
| 137 |
<Nav onSelect={onNavSelect} aria-label="Nav"> |
| 138 |
<NavList> |
| 139 |
<NavItem itemId={0} isActive={activeItem === 0}> |
| 140 |
System Panel |
| 141 |
</NavItem> |
| 142 |
<NavItem itemId={1} isActive={activeItem === 1}> |
| 143 |
Policy |
| 144 |
</NavItem> |
| 145 |
<NavItem itemId={2} isActive={activeItem === 2}> |
| 146 |
Authentication |
| 147 |
</NavItem> |
| 148 |
<NavItem itemId={3} isActive={activeItem === 3}> |
| 149 |
Network Services |
| 150 |
</NavItem> |
| 151 |
<NavItem itemId={4} isActive={activeItem === 4}> |
| 152 |
Server |
| 153 |
</NavItem> |
| 154 |
</NavList> |
| 155 |
</Nav> |
| 156 |
); |
| 157 |
const kebabDropdownItems = ( |
| 158 |
<> |
| 159 |
<DropdownItem> |
| 160 |
<RhUiSettingsFillIcon /> Settings |
| 161 |
</DropdownItem> |
| 162 |
<DropdownItem> |
| 163 |
<HelpIcon /> Help |
| 164 |
</DropdownItem> |
| 165 |
</> |
| 166 |
); |
| 167 |
const userDropdownItems = ( |
| 168 |
<> |
| 169 |
<DropdownItem key="group 2 profile">My profile</DropdownItem> |
| 170 |
<DropdownItem key="group 2 user">User management</DropdownItem> |
| 171 |
<DropdownItem key="group 2 logout">Logout</DropdownItem> |
| 172 |
</> |
| 173 |
); |
| 174 |
const headerToolbar = ( |
| 175 |
<Toolbar> |
| 176 |
<ToolbarContent> |
| 177 |
<ToolbarGroup align={{ default: 'alignEnd' }}> |
| 178 |
<ToolbarGroup variant="action-group-plain"> |
| 179 |
<ToolbarItem visibility={{ default: 'visible' }} selected={isDrawerExpanded}> |
| 180 |
<NotificationBadge |
| 181 |
variant={getNumberUnread() === 0 ? 'read' : 'unread'} |
| 182 |
onClick={(event: any) => onCloseNotificationDrawer(event)} |
| 183 |
aria-label="Notifications" |
| 184 |
isExpanded={isDrawerExpanded} |
| 185 |
/> |
| 186 |
</ToolbarItem> |
| 187 |
<ToolbarGroup |
| 188 |
variant="action-group-plain" |
| 189 |
visibility={{ |
| 190 |
default: 'hidden', |
| 191 |
lg: 'visible' |
| 192 |
}} /** the settings and help icon buttons are only visible on desktop sizes and replaced by a kebab dropdown for other sizes */ |
| 193 |
> |
| 194 |
<ToolbarItem> |
| 195 |
<Button aria-label="Settings actions" isSettings variant="plain" /> |
| 196 |
</ToolbarItem> |
| 197 |
<ToolbarItem> |
| 198 |
<Button |
| 199 |
aria-label="Help actions" |
| 200 |
variant={ButtonVariant.plain} |
| 201 |
icon={<RhUiQuestionMarkCircleFillIcon />} |
| 202 |
/> |
| 203 |
</ToolbarItem> |
| 204 |
</ToolbarGroup> |
| 205 |
</ToolbarGroup> |
| 206 |
<ToolbarGroup> |
| 207 |
<ToolbarItem |
| 208 |
visibility={{ |
| 209 |
lg: 'hidden' |
| 210 |
}} /** this kebab dropdown replaces the icon buttons and is hidden for desktop sizes */ |
| 211 |
> |
| 212 |
<Dropdown |
| 213 |
isOpen={isKebabDropdownOpen} |
| 214 |
onSelect={onKebabDropdownSelect} |
| 215 |
onOpenChange={setIsKebabDropdownOpen} |
| 216 |
popperProps={{ position: 'right' }} |
| 217 |
toggle={(toggleRef: React.RefObject<any>) => ( |
| 218 |
<MenuToggle |
| 219 |
ref={toggleRef} |
| 220 |
isExpanded={isKebabDropdownOpen} |
| 221 |
onClick={onKebabDropdownToggle} |
| 222 |
variant="plain" |
| 223 |
aria-label="Settings and help" |
| 224 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 225 |
/> |
| 226 |
)} |
| 227 |
> |
| 228 |
<DropdownList>{kebabDropdownItems}</DropdownList> |
| 229 |
</Dropdown> |
| 230 |
</ToolbarItem> |
| 231 |
<ToolbarItem |
| 232 |
visibility={{ default: 'hidden', md: 'visible' }} /** this user dropdown is hidden on mobile sizes */ |
| 233 |
> |
| 234 |
<Dropdown |
| 235 |
isOpen={isDropdownOpen} |
| 236 |
onSelect={onDropdownSelect} |
| 237 |
onOpenChange={setIsDropdownOpen} |
| 238 |
popperProps={{ position: 'right' }} |
| 239 |
toggle={(toggleRef: React.RefObject<any>) => ( |
| 240 |
<MenuToggle |
| 241 |
ref={toggleRef} |
| 242 |
isExpanded={isDropdownOpen} |
| 243 |
onClick={onDropdownToggle} |
| 244 |
icon={<Avatar src={imgAvatar} alt="" size="sm" />} |
| 245 |
> |
| 246 |
John Smith |
| 247 |
</MenuToggle> |
| 248 |
)} |
| 249 |
> |
| 250 |
<DropdownList>{userDropdownItems}</DropdownList> |
| 251 |
</Dropdown> |
| 252 |
</ToolbarItem> |
| 253 |
</ToolbarGroup> |
| 254 |
</ToolbarGroup> |
| 255 |
</ToolbarContent> |
| 256 |
</Toolbar> |
| 257 |
); |
| 258 |
|
| 259 |
const masthead = ( |
| 260 |
<Masthead> |
| 261 |
<MastheadMain> |
| 262 |
<MastheadToggle> |
| 263 |
<PageToggleButton isHamburgerButton aria-label="Global navigation" /> |
| 264 |
</MastheadToggle> |
| 265 |
<MastheadBrand> |
| 266 |
<MastheadLogo> |
| 267 |
<Brand src={pfLogo} alt="PatternFly" heights={{ default: '36px' }} /> |
| 268 |
</MastheadLogo> |
| 269 |
</MastheadBrand> |
| 270 |
</MastheadMain> |
| 271 |
<MastheadContent>{headerToolbar}</MastheadContent> |
| 272 |
</Masthead> |
| 273 |
); |
| 274 |
const Sidebar = ( |
| 275 |
<PageSidebar> |
| 276 |
<PageSidebarBody>{PageNav}</PageSidebarBody> |
| 277 |
</PageSidebar> |
| 278 |
); |
| 279 |
const pageId = 'main-content-page-layout-default-nav'; |
| 280 |
|
| 281 |
const handleClick = (event) => { |
| 282 |
event.preventDefault(); |
| 283 |
|
| 284 |
const mainContentElement = document.getElementById(pageId); |
| 285 |
if (mainContentElement) { |
| 286 |
mainContentElement.focus(); |
| 287 |
} |
| 288 |
}; |
| 289 |
|
| 290 |
const PageSkipToContent = ( |
| 291 |
<SkipToContent onClick={handleClick} href={`#${pageId}`}> |
| 292 |
Skip to content |
| 293 |
</SkipToContent> |
| 294 |
); |
| 295 |
|
| 296 |
const PageBreadcrumb = ( |
| 297 |
<Breadcrumb> |
| 298 |
<BreadcrumbItem>Section home</BreadcrumbItem> |
| 299 |
<BreadcrumbItem to="#">Section title</BreadcrumbItem> |
| 300 |
<BreadcrumbItem to="#">Section title</BreadcrumbItem> |
| 301 |
<BreadcrumbItem to="#" isActive> |
| 302 |
Section landing |
| 303 |
</BreadcrumbItem> |
| 304 |
</Breadcrumb> |
| 305 |
); |
| 306 |
|
| 307 |
const notificationDrawerActions = ( |
| 308 |
<> |
| 309 |
<DropdownItem key="markAllRead" onClick={markAllRead}> |
| 310 |
Mark all read |
| 311 |
</DropdownItem> |
| 312 |
<DropdownItem key="clearAll" onClick={() => showNotifications(false)}> |
| 313 |
Clear all |
| 314 |
</DropdownItem> |
| 315 |
<DropdownItem key="unclearLast" onClick={() => showNotifications(true)}> |
| 316 |
Unclear last |
| 317 |
</DropdownItem> |
| 318 |
<DropdownItem key="settings">Settings</DropdownItem> |
| 319 |
</> |
| 320 |
); |
| 321 |
const notificationDrawerDropdownItems = ( |
| 322 |
<> |
| 323 |
<DropdownItem |
| 324 |
key="link" |
| 325 |
to="#" |
| 326 |
// Prevent default onClick behavior for demo purposes |
| 327 |
onClick={(ev: any) => ev.preventDefault()} |
| 328 |
> |
| 329 |
Link |
| 330 |
</DropdownItem> |
| 331 |
<DropdownItem key="action">Action</DropdownItem> |
| 332 |
<Divider component="li" key="separator" /> |
| 333 |
<DropdownItem key="disabled link" isDisabled> |
| 334 |
Disabled Link |
| 335 |
</DropdownItem> |
| 336 |
</> |
| 337 |
); |
| 338 |
const notificationDrawer = ( |
| 339 |
<NotificationDrawer ref={drawerRef}> |
| 340 |
<NotificationDrawerHeader count={getNumberUnread()} onClose={onCloseNotificationDrawer}> |
| 341 |
<Dropdown |
| 342 |
onSelect={closeActionsMenu} |
| 343 |
isOpen={isActionsMenuOpen['toggle-id-0'] || false} |
| 344 |
id="notification-0" |
| 345 |
onOpenChange={(isOpen: boolean) => !isOpen && closeActionsMenu()} |
| 346 |
popperProps={{ position: 'right' }} |
| 347 |
toggle={(toggleRef: React.RefObject<any>) => ( |
| 348 |
<MenuToggle |
| 349 |
ref={toggleRef} |
| 350 |
id="toggle-id-0" |
| 351 |
aria-label="Notification drawer actions" |
| 352 |
variant="plain" |
| 353 |
onClick={() => onToggle('toggle-id-0')} |
| 354 |
isExpanded={isActionsMenuOpen['toggle-id-0'] || false} |
| 355 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 356 |
/> |
| 357 |
)} |
| 358 |
> |
| 359 |
<DropdownList>{notificationDrawerActions}</DropdownList> |
| 360 |
</Dropdown> |
| 361 |
</NotificationDrawerHeader> |
| 362 |
<NotificationDrawerBody> |
| 363 |
{shouldShowNotifications && ( |
| 364 |
<NotificationDrawerList> |
| 365 |
<NotificationDrawerListItem |
| 366 |
variant="info" |
| 367 |
onClick={() => onListItemClick('notification-1')} |
| 368 |
isRead={isUnreadMap === null || !isUnreadMap['notification-1']} |
| 369 |
> |
| 370 |
<NotificationDrawerListItemHeader |
| 371 |
variant="info" |
| 372 |
title="Unread info notification title" |
| 373 |
srTitle="Info notification:" |
| 374 |
> |
| 375 |
<Dropdown |
| 376 |
onSelect={closeActionsMenu} |
| 377 |
isOpen={isActionsMenuOpen['toggle-id-1'] || false} |
| 378 |
id="notification-1" |
| 379 |
onOpenChange={(isOpen: boolean) => !isOpen && closeActionsMenu()} |
| 380 |
popperProps={{ position: 'right' }} |
| 381 |
toggle={(toggleRef: React.RefObject<any>) => ( |
| 382 |
<MenuToggle |
| 383 |
ref={toggleRef} |
| 384 |
id="toggle-id-1" |
| 385 |
aria-label="Notification drawer actions" |
| 386 |
variant="plain" |
| 387 |
onClick={() => onToggle('toggle-id-1')} |
| 388 |
isExpanded={isActionsMenuOpen['toggle-id-1'] || false} |
| 389 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 390 |
/> |
| 391 |
)} |
| 392 |
> |
| 393 |
<DropdownList>{notificationDrawerDropdownItems}</DropdownList> |
| 394 |
</Dropdown> |
| 395 |
</NotificationDrawerListItemHeader> |
| 396 |
<NotificationDrawerListItemBody timestamp="5 minutes ago"> |
| 397 |
This is an info notification description. |
| 398 |
</NotificationDrawerListItemBody> |
| 399 |
</NotificationDrawerListItem> |
| 400 |
<NotificationDrawerListItem |
| 401 |
variant="danger" |
| 402 |
onClick={() => onListItemClick('notification-2')} |
| 403 |
isRead={isUnreadMap === null || !isUnreadMap['notification-2']} |
| 404 |
> |
| 405 |
<NotificationDrawerListItemHeader |
| 406 |
variant="danger" |
| 407 |
title="Unread danger notification title. This is a long title to show how the title will wrap if it is long and wraps to multiple lines." |
| 408 |
srTitle="Danger notification:" |
| 409 |
> |
| 410 |
<Dropdown |
| 411 |
onSelect={closeActionsMenu} |
| 412 |
isOpen={isActionsMenuOpen['toggle-id-2'] || false} |
| 413 |
id="notification-2" |
| 414 |
onOpenChange={(isOpen: boolean) => !isOpen && closeActionsMenu()} |
| 415 |
popperProps={{ position: 'right' }} |
| 416 |
toggle={(toggleRef: React.RefObject<any>) => ( |
| 417 |
<MenuToggle |
| 418 |
ref={toggleRef} |
| 419 |
id="toggle-id-2" |
| 420 |
aria-label="Notification drawer actions" |
| 421 |
variant="plain" |
| 422 |
onClick={() => onToggle('toggle-id-2')} |
| 423 |
isExpanded={isActionsMenuOpen['toggle-id-2'] || false} |
| 424 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 425 |
/> |
| 426 |
)} |
| 427 |
> |
| 428 |
<DropdownList>{notificationDrawerDropdownItems}</DropdownList> |
| 429 |
</Dropdown> |
| 430 |
</NotificationDrawerListItemHeader> |
| 431 |
<NotificationDrawerListItemBody timestamp="10 minutes ago"> |
| 432 |
This is a danger notification description. This is a long description to show how the title will wrap if |
| 433 |
it is long and wraps to multiple lines. |
| 434 |
</NotificationDrawerListItemBody> |
| 435 |
</NotificationDrawerListItem> |
| 436 |
<NotificationDrawerListItem |
| 437 |
variant="warning" |
| 438 |
onClick={() => onListItemClick('notification-3')} |
| 439 |
isRead={isUnreadMap === null || !isUnreadMap['notification-3']} |
| 440 |
> |
| 441 |
<NotificationDrawerListItemHeader |
| 442 |
variant="warning" |
| 443 |
title="Read warning notification title" |
| 444 |
srTitle="Warning notification:" |
| 445 |
> |
| 446 |
<Dropdown |
| 447 |
onSelect={closeActionsMenu} |
| 448 |
isOpen={isActionsMenuOpen['toggle-id-3'] || false} |
| 449 |
id="notification-3" |
| 450 |
onOpenChange={(isOpen: boolean) => !isOpen && closeActionsMenu()} |
| 451 |
popperProps={{ position: 'right' }} |
| 452 |
toggle={(toggleRef: React.RefObject<any>) => ( |
| 453 |
<MenuToggle |
| 454 |
ref={toggleRef} |
| 455 |
id="toggle-id-3" |
| 456 |
aria-label="Notification drawer actions" |
| 457 |
variant="plain" |
| 458 |
onClick={() => onToggle('toggle-id-3')} |
| 459 |
isExpanded={isActionsMenuOpen['toggle-id-3'] || false} |
| 460 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 461 |
/> |
| 462 |
)} |
| 463 |
> |
| 464 |
<DropdownList>{notificationDrawerDropdownItems}</DropdownList> |
| 465 |
</Dropdown> |
| 466 |
</NotificationDrawerListItemHeader> |
| 467 |
<NotificationDrawerListItemBody timestamp="20 minutes ago"> |
| 468 |
This is a warning notification description. |
| 469 |
</NotificationDrawerListItemBody> |
| 470 |
</NotificationDrawerListItem> |
| 471 |
<NotificationDrawerListItem |
| 472 |
variant="success" |
| 473 |
onClick={() => onListItemClick('notification-4')} |
| 474 |
isRead={isUnreadMap === null || !isUnreadMap['notification-4']} |
| 475 |
> |
| 476 |
<NotificationDrawerListItemHeader |
| 477 |
variant="success" |
| 478 |
title="Read success notification title" |
| 479 |
srTitle="Success notification:" |
| 480 |
> |
| 481 |
<Dropdown |
| 482 |
onSelect={closeActionsMenu} |
| 483 |
isOpen={isActionsMenuOpen['toggle-id-4'] || false} |
| 484 |
id="notification-4" |
| 485 |
onOpenChange={(isOpen: boolean) => !isOpen && closeActionsMenu()} |
| 486 |
popperProps={{ position: 'right' }} |
| 487 |
toggle={(toggleRef: React.RefObject<any>) => ( |
| 488 |
<MenuToggle |
| 489 |
ref={toggleRef} |
| 490 |
id="toggle-id-4" |
| 491 |
aria-label="Notification drawer actions" |
| 492 |
variant="plain" |
| 493 |
onClick={() => onToggle('toggle-id-4')} |
| 494 |
isExpanded={isActionsMenuOpen['toggle-id-4'] || false} |
| 495 |
icon={<RhUiEllipsisVerticalFillIcon />} |
| 496 |
/> |
| 497 |
)} |
| 498 |
> |
| 499 |
<DropdownList>{notificationDrawerDropdownItems}</DropdownList> |
| 500 |
</Dropdown> |
| 501 |
</NotificationDrawerListItemHeader> |
| 502 |
<NotificationDrawerListItemBody timestamp="30 minutes ago"> |
| 503 |
This is a success notification description. |
| 504 |
</NotificationDrawerListItemBody> |
| 505 |
</NotificationDrawerListItem> |
| 506 |
</NotificationDrawerList> |
| 507 |
)} |
| 508 |
{!shouldShowNotifications && ( |
| 509 |
<EmptyState headingLevel="h2" titleText="No alerts found" icon={SearchIcon} variant={EmptyStateVariant.full}> |
| 510 |
<EmptyStateBody> |
| 511 |
There are currently no alerts. There may be silenced critical alerts however. |
| 512 |
</EmptyStateBody> |
| 513 |
<EmptyStateFooter> |
| 514 |
<EmptyStateActions> |
| 515 |
<Button variant="link">Action</Button> |
| 516 |
</EmptyStateActions> |
| 517 |
</EmptyStateFooter> |
| 518 |
</EmptyState> |
| 519 |
)} |
| 520 |
</NotificationDrawerBody> |
| 521 |
</NotificationDrawer> |
| 522 |
); |
| 523 |
|
| 524 |
return ( |
| 525 |
<Fragment> |
| 526 |
<Page |
| 527 |
masthead={masthead} |
| 528 |
sidebar={Sidebar} |
| 529 |
isManagedSidebar |
| 530 |
notificationDrawer={notificationDrawer} |
| 531 |
onNotificationDrawerExpand={( |
| 532 |
event: React.MouseEvent<Element, MouseEvent> | KeyboardEvent | React.TransitionEvent<Element> |
| 533 |
) => focusDrawer(event)} |
| 534 |
isNotificationDrawerExpanded={isDrawerExpanded} |
| 535 |
skipToContent={PageSkipToContent} |
| 536 |
breadcrumb={PageBreadcrumb} |
| 537 |
mainContainerId={pageId} |
| 538 |
> |
| 539 |
<PageSection aria-labelledby="main-title"> |
| 540 |
<Content> |
| 541 |
<h1 id="main-title">Main title</h1> |
| 542 |
<p> |
| 543 |
Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br /> |
| 544 |
of its relative line height of 1.5. |
| 545 |
</p> |
| 546 |
</Content> |
| 547 |
</PageSection> |
| 548 |
<PageSection aria-label="Panel section">Panel section content</PageSection> |
| 549 |
</Page> |
| 550 |
</Fragment> |
| 551 |
); |
| 552 |
}; |