forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageMainSectionPadding.tsx
More file actions
81 lines (75 loc) · 2.26 KB
/
PageMainSectionPadding.tsx
File metadata and controls
81 lines (75 loc) · 2.26 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
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 PageMainSectionPadding: React.FunctionComponent = () => {
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
const onSidebarToggle = () => {
setIsSidebarOpen(!isSidebarOpen);
};
const headerToolbar = (
<Toolbar id="main-padding-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="main-padding-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="main-padding-sidebar">
<PageSidebarBody>Navigation</PageSidebarBody>
</PageSidebar>
);
return (
<Page masthead={masthead} sidebar={sidebar}>
<PageSection aria-labelledby="section-1">
<h2 id="section-1">Section with default padding</h2>
</PageSection>
<PageSection padding={{ default: 'noPadding' }} aria-labelledby="section-2">
<h2 id="section-2">Section with no padding</h2>
</PageSection>
<PageSection padding={{ default: 'noPadding', md: 'padding' }} aria-labelledby="section-3">
<h2 id="section-3">Section with padding on medium</h2>
</PageSection>
<PageSection padding={{ md: 'noPadding' }} aria-labelledby="section-4">
<h2 id="section-4">Section with no padding on medium</h2>
</PageSection>
</Page>
);
};