Debian Codegraph @

node/@patternfly/react-core/src/components/Page/examples/PageMainSectionVariations.tsx

raw
1 import { useState } from 'react';
2 import {
3 Page,
4 Masthead,
5 MastheadMain,
6 MastheadToggle,
7 MastheadBrand,
8 MastheadLogo,
9 MastheadContent,
10 PageSidebar,
11 PageSidebarBody,
12 PageSection,
13 PageToggleButton,
14 Toolbar,
15 ToolbarContent,
16 ToolbarItem
17 } from '@patternfly/react-core';
18
19 export const PageMainSectionPadding: React.FunctionComponent = () => {
20 const [isSidebarOpen, setIsSidebarOpen] = useState(true);
21
22 const onSidebarToggle = () => {
23 setIsSidebarOpen(!isSidebarOpen);
24 };
25
26 const headerToolbar = (
27 <Toolbar id="main-variations-toolbar">
28 <ToolbarContent>
29 <ToolbarItem>header-tools</ToolbarItem>
30 </ToolbarContent>
31 </Toolbar>
32 );
33
34 const header = (
35 <Masthead>
36 <MastheadMain>
37 <MastheadToggle>
38 <PageToggleButton
39 aria-label="Global navigation"
40 isSidebarOpen={isSidebarOpen}
41 onSidebarToggle={onSidebarToggle}
42 id="main-variations-nav-toggle"
43 isHamburgerButton
44 />
45 </MastheadToggle>
46 <MastheadBrand>
47 <MastheadLogo href="https://patternfly.org" target="_blank">
48 Logo
49 </MastheadLogo>
50 </MastheadBrand>
51 </MastheadMain>
52 <MastheadContent>{headerToolbar}</MastheadContent>
53 </Masthead>
54 );
55
56 const sidebar = (
57 <PageSidebar isSidebarOpen={isSidebarOpen} id="main-variations-sidebar">
58 <PageSidebarBody>Navigation</PageSidebarBody>
59 </PageSidebar>
60 );
61
62 return (
63 <Page header={header} sidebar={sidebar}>
64 <PageSection type="subnav" aria-label="With subnav type">
65 Section with <code>type="subnav"</code> for horizontal subnav navigation
66 </PageSection>
67 <PageSection type="nav" aria-label="With nav type">
68 Section with <code>type="nav"</code> for tertiary navigation
69 </PageSection>
70 <PageSection type="tabs" aria-label="With tabs type">
71 Section with <code>type="tabs"</code> for tabs
72 </PageSection>
73 <PageSection type="breadcrumb" aria-label="With breadcrumb type">
74 Section with <code>type="breadcrumb"</code> for breadcrumbs
75 </PageSection>
76 <PageSection aria-label="With default type">
77 Section without <code>type</code> prop or <code>type="default"</code> for main sections
78 </PageSection>
79 <PageSection type="wizard" aria-label="With wizard type">
80 Section with <code>type="wizard"</code> for wizards
81 </PageSection>
82 </Page>
83 );
84 };