forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageGroupSection.tsx
More file actions
116 lines (110 loc) · 3.11 KB
/
PageGroupSection.tsx
File metadata and controls
116 lines (110 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { useState } from 'react';
import {
Page,
Masthead,
MastheadMain,
MastheadToggle,
MastheadBrand,
MastheadLogo,
MastheadContent,
PageSidebar,
PageSidebarBody,
PageSection,
PageGroup,
PageBreadcrumb,
PageToggleButton,
Breadcrumb,
BreadcrumbItem,
Nav,
NavList,
NavItem,
Toolbar,
ToolbarContent,
ToolbarItem
} from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
export const PageGroupSection: React.FunctionComponent = () => {
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
const onSidebarToggle = () => {
setIsSidebarOpen(!isSidebarOpen);
};
const headerToolbar = (
<Toolbar id="group-section-toolbar">
<ToolbarContent>
<ToolbarItem>header-tools</ToolbarItem>
</ToolbarContent>
</Toolbar>
);
const masthead = (
<Masthead>
<MastheadMain>
<MastheadToggle>
<PageToggleButton
variant="plain"
aria-label="Global navigation"
isSidebarOpen={isSidebarOpen}
onSidebarToggle={onSidebarToggle}
id="group-section-nav-toggle"
>
<BarsIcon />
</PageToggleButton>
</MastheadToggle>
<MastheadBrand>
<MastheadLogo href="https://patternfly.org" target="_blank">
Logo
</MastheadLogo>
</MastheadBrand>
</MastheadMain>
<MastheadContent>{headerToolbar}</MastheadContent>
</Masthead>
);
const sidebar = (
<PageSidebar isSidebarOpen={isSidebarOpen} id="group-section-sidebar">
<PageSidebarBody>Navigation</PageSidebarBody>
</PageSidebar>
);
return (
<Page masthead={masthead} sidebar={sidebar}>
<PageGroup>
<Nav aria-label="Group section navigation" variant="horizontal-subnav">
<NavList>
<NavItem href="#" itemId={0} isActive>
System panel
</NavItem>
<NavItem href="#" itemId={1}>
Policy
</NavItem>
<NavItem href="#" itemId={2}>
Authentication
</NavItem>
<NavItem href="#" itemId={3}>
Network services
</NavItem>
<NavItem href="#" itemId={4}>
Server
</NavItem>
</NavList>
</Nav>
<PageBreadcrumb>
<Breadcrumb>
<BreadcrumbItem>Section home</BreadcrumbItem>
<BreadcrumbItem to="#">Section title</BreadcrumbItem>
<BreadcrumbItem to="#">Section title</BreadcrumbItem>
<BreadcrumbItem to="#" isActive>
Section landing
</BreadcrumbItem>
</Breadcrumb>
</PageBreadcrumb>
<PageSection aria-labelledby="grouped-section">
<h2 id="grouped-section">Grouped section</h2>
</PageSection>
</PageGroup>
<PageSection aria-labelledby="section-1">
<h2 id="section-1">Grouped example section 1</h2>
</PageSection>
<PageSection aria-labelledby="section-2">
<h2 id="section-2">Grouped example section 2</h2>
</PageSection>
</Page>
);
};