|
2 | 2 | 'use client'; |
3 | 3 |
|
4 | 4 | import * as React from 'react'; |
5 | | -import { useRouter, usePathname } from 'next/navigation'; |
6 | | -import { useSession } from 'next-auth/react'; |
| 5 | + |
| 6 | +import { Page, PageToggleButton } from '@patternfly/react-core/dist/dynamic/components/Page'; |
| 7 | +import { Text, TextContent, TextVariants } from '@patternfly/react-core/dist/dynamic/components/Text'; |
| 8 | +import { usePathname, useRouter } from 'next/navigation'; |
| 9 | + |
| 10 | +import { BarsIcon } from '@patternfly/react-icons/dist/dynamic/icons/bars-icon'; |
7 | 11 | import { Brand } from '@patternfly/react-core/dist/dynamic/components/Brand'; |
8 | | -import { Button } from '@patternfly/react-core/dist/dynamic/components/Button'; |
| 12 | +import HelpDropdown from './HelpDropdown/HelpDropdown'; |
| 13 | +import Link from 'next/link'; |
9 | 14 | import { Masthead } from '@patternfly/react-core/dist/dynamic/components/Masthead'; |
10 | 15 | import { MastheadBrand } from '@patternfly/react-core/dist/dynamic/components/Masthead'; |
| 16 | +import { MastheadContent } from '@patternfly/react-core/dist/dynamic/components/Masthead'; |
11 | 17 | import { MastheadMain } from '@patternfly/react-core/dist/dynamic/components/Masthead'; |
12 | 18 | import { MastheadToggle } from '@patternfly/react-core/dist/dynamic/components/Masthead'; |
13 | | -import { MastheadContent } from '@patternfly/react-core/dist/dynamic/components/Masthead'; |
14 | 19 | import { Nav } from '@patternfly/react-core/dist/dynamic/components/Nav'; |
| 20 | +import { NavExpandable } from '@patternfly/react-core/dist/dynamic/components/Nav'; |
15 | 21 | import { NavItem } from '@patternfly/react-core/dist/dynamic/components/Nav'; |
16 | 22 | import { NavList } from '@patternfly/react-core/dist/dynamic/components/Nav'; |
17 | | -import { NavExpandable } from '@patternfly/react-core/dist/dynamic/components/Nav'; |
18 | | -import { Page } from '@patternfly/react-core/dist/dynamic/components/Page'; |
19 | 23 | import { PageSidebar } from '@patternfly/react-core/dist/dynamic/components/Page'; |
20 | 24 | import { PageSidebarBody } from '@patternfly/react-core/dist/dynamic/components/Page'; |
21 | 25 | import { SkipToContent } from '@patternfly/react-core/dist/dynamic/components/SkipToContent'; |
22 | 26 | import { Spinner } from '@patternfly/react-core/dist/dynamic/components/Spinner'; |
23 | | -import { BarsIcon } from '@patternfly/react-icons/dist/dynamic/icons/bars-icon'; |
24 | | -import { TextContent, Text, TextVariants } from '@patternfly/react-core/dist/dynamic/components/Text'; |
25 | | -import { useTheme } from '../context/ThemeContext'; |
26 | | -import Link from 'next/link'; |
27 | | -import HelpDropdown from './HelpDropdown/HelpDropdown'; |
28 | 27 | import UserMenu from './UserMenu/UserMenu'; |
| 28 | +import { useSession } from 'next-auth/react'; |
| 29 | +import { useTheme } from '../context/ThemeContext'; |
29 | 30 |
|
30 | 31 | interface IAppLayout { |
31 | 32 | children: React.ReactNode; |
32 | 33 | } |
33 | 34 |
|
34 | 35 | const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => { |
35 | | - const [sidebarOpen, setSidebarOpen] = React.useState(true); |
36 | 36 | const { theme } = useTheme(); |
37 | 37 | const { data: session, status } = useSession(); |
38 | 38 | const router = useRouter(); |
@@ -76,9 +76,9 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => { |
76 | 76 | const Header = ( |
77 | 77 | <Masthead> |
78 | 78 | <MastheadToggle> |
79 | | - <Button variant="plain" onClick={() => setSidebarOpen(!sidebarOpen)} aria-label="Global navigation"> |
| 79 | + <PageToggleButton variant="plain" aria-label="Global navigation"> |
80 | 80 | <BarsIcon /> |
81 | | - </Button> |
| 81 | + </PageToggleButton> |
82 | 82 | </MastheadToggle> |
83 | 83 | <MastheadMain style={{ flexShrink: 1, display: 'flex', alignItems: 'center' }}> |
84 | 84 | <MastheadBrand> |
@@ -137,7 +137,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => { |
137 | 137 | const PageSkipToContent = <SkipToContent href={`#${pageId}`}>Skip to Content</SkipToContent>; |
138 | 138 |
|
139 | 139 | return ( |
140 | | - <Page mainContainerId={pageId} header={Header} sidebar={sidebarOpen && Sidebar} skipToContent={PageSkipToContent}> |
| 140 | + <Page mainContainerId={pageId} header={Header} isManagedSidebar sidebar={Sidebar} skipToContent={PageSkipToContent}> |
141 | 141 | {children} |
142 | 142 | </Page> |
143 | 143 | ); |
|
0 commit comments