Debian Codegraph @

node/@patternfly/react-core/src/components/Page/examples/PagePlainSections.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 PageGroup,
14 PageToggleButton,
15 Toolbar,
16 ToolbarContent,
17 ToolbarItem
18 } from '@patternfly/react-core';
19
20 export const PagePlainSections: React.FunctionComponent = () => {
21 const [isSidebarOpen, setIsSidebarOpen] = useState(true);
22
23 const onSidebarToggle = () => {
24 setIsSidebarOpen(!isSidebarOpen);
25 };
26
27 const headerToolbar = (
28 <Toolbar id="plain-sections-toolbar">
29 <ToolbarContent>
30 <ToolbarItem>header-tools</ToolbarItem>
31 </ToolbarContent>
32 </Toolbar>
33 );
34
35 const masthead = (
36 <Masthead>
37 <MastheadMain>
38 <MastheadToggle>
39 <PageToggleButton
40 aria-label="Plain sections example navigation"
41 isSidebarOpen={isSidebarOpen}
42 onSidebarToggle={onSidebarToggle}
43 id="plain-sections-nav-toggle"
44 isHamburgerButton
45 />
46 </MastheadToggle>
47 <MastheadBrand>
48 <MastheadLogo href="https://patternfly.org" target="_blank">
49 Logo
50 </MastheadLogo>
51 </MastheadBrand>
52 </MastheadMain>
53 <MastheadContent>{headerToolbar}</MastheadContent>
54 </Masthead>
55 );
56
57 const sidebar = (
58 <PageSidebar isSidebarOpen={isSidebarOpen} id="plain-sections-sidebar">
59 <PageSidebarBody>Navigation</PageSidebarBody>
60 </PageSidebar>
61 );
62
63 return (
64 <Page masthead={masthead} sidebar={sidebar}>
65 <PageSection isPlain aria-label="Plain section example">
66 <h2>Plain PageSection</h2>
67 <p>
68 This section uses <code>isPlain</code> to apply plain styling with no background color.
69 </p>
70 </PageSection>
71 <PageSection aria-label="Default section example">
72 <h2>Default PageSection</h2>
73 <p>This section has the default styling with a background color.</p>
74 </PageSection>
75 <PageGroup isPlain>
76 <PageSection aria-label="Section in plain group">
77 <h2>PageSection inside Plain PageGroup</h2>
78 <p>
79 This section is inside a PageGroup with <code>isPlain</code> applied.
80 </p>
81 </PageSection>
82 <PageSection aria-label="Another section in plain group">
83 <h2>Another Section in Plain Group</h2>
84 <p>Both sections are grouped with plain styling.</p>
85 </PageSection>
86 </PageGroup>
87 <PageSection variant="secondary" aria-label="Secondary variant section">
88 <h2>Secondary Variant Section</h2>
89 <p>This section uses the secondary variant for contrast.</p>
90 </PageSection>
91 </Page>
92 );
93 };