forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageWithOrWithoutFill.tsx
More file actions
78 lines (72 loc) · 2.03 KB
/
PageWithOrWithoutFill.tsx
File metadata and controls
78 lines (72 loc) · 2.03 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
import { useState } from 'react';
import {
Page,
Masthead,
MastheadMain,
MastheadToggle,
MastheadBrand,
MastheadLogo,
MastheadContent,
PageSidebar,
PageSidebarBody,
PageSection,
PageToggleButton,
Toolbar,
ToolbarContent,
ToolbarItem
} from '@patternfly/react-core';
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
export const PageWithOrWithoutFill: React.FunctionComponent = () => {
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
const onSidebarToggle = () => {
setIsSidebarOpen(!isSidebarOpen);
};
const headerToolbar = (
<Toolbar id="fill-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="fill-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="fill-sidebar">
<PageSidebarBody>Navigation</PageSidebarBody>
</PageSidebar>
);
return (
<Page isContentFilled masthead={masthead} sidebar={sidebar}>
<PageSection aria-labelledby="section-1">
<h2 id="section-1">Section without fill</h2>
</PageSection>
<PageSection isFilled={true} variant="secondary" aria-labelledby="section-2">
<h2 id="section-2">Section with fill</h2>
</PageSection>
<PageSection aria-labelledby="section-3">
<h2 id="section-3">Another section without fill</h2>
</PageSection>
</Page>
);
};