Jaime Ramírez
2020-06-11 d4efcf556bee5599b87a18da9420df2143e1c757
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
import React from "react";
import { Brand, Page, PageHeader, PageSidebar } from "@patternfly/react-core";
import imgBrand from "./training_white.png";
import NavList from "./Components/NavList";
 
 
type LayoutProps = {
    children: any
}
 
type LayoutState = {
    isNavOpen: boolean
}
 
export default class Layout extends React.Component<LayoutProps, LayoutState> {
 
    constructor(props: LayoutProps) {
        super(props);
 
        this.state = {
            isNavOpen: true,
        };
    }
 
 
    public render() {
        const { isNavOpen } = this.state;
 
        const logoProps = {
            href: "/frontend/"
        };
 
        const Header = (
            <PageHeader
                logo={<Brand src={imgBrand} alt="Red Hat Training Logo" className="logo"/>}
                logoProps={logoProps}
                showNavToggle
                isNavOpen={isNavOpen}
                onNavToggle={this.onNavToggle.bind(this)}
                style={{ borderTop: "2px solid #c00" }}
            />
        );
 
        const Sidebar = <PageSidebar nav={<NavList/>} isNavOpen={isNavOpen} theme="dark" />;
 
        return (
            <Page header={Header} sidebar={Sidebar} style={{minHeight: 800}}>
                {this.props.children}
            </Page>
        );
    }
 
    private onNavToggle() {
        this.setState({
            isNavOpen: !this.state.isNavOpen
        });
    }
}