-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌱 chore(Header): use new pf masthead (#1282)
closes #1243 --------- Signed-off-by: gitdallas <[email protected]> Co-authored-by: Ian Bolton <[email protected]>
- Loading branch information
1 parent
b086b18
commit a9f64a7
Showing
3 changed files
with
320 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,109 @@ | ||
import React from "react"; | ||
import { Brand, Button, ButtonVariant, Title } from "@patternfly/react-core"; | ||
import { | ||
PageHeader, | ||
PageHeaderTools, | ||
PageHeaderToolsGroup, | ||
PageHeaderToolsItem, | ||
} from "@patternfly/react-core/deprecated"; | ||
Brand, | ||
Button, | ||
ButtonVariant, | ||
Masthead, | ||
MastheadBrand, | ||
MastheadContent, | ||
MastheadMain, | ||
MastheadToggle, | ||
PageToggleButton, | ||
Title, | ||
Toolbar, | ||
ToolbarContent, | ||
ToolbarGroup, | ||
ToolbarItem, | ||
} from "@patternfly/react-core"; | ||
import HelpIcon from "@patternfly/react-icons/dist/esm/icons/help-icon"; | ||
|
||
import BarsIcon from "@patternfly/react-icons/dist/js/icons/bars-icon"; | ||
import { AppAboutModalState } from "../AppAboutModalState"; | ||
import { SSOMenu } from "./SSOMenu"; | ||
import { MobileDropdown } from "./MobileDropdown"; | ||
|
||
import konveyorBrandImage from "@app/images/Konveyor-white-logo.svg"; | ||
import { APP_BRAND, BrandType, isAuthRequired } from "@app/Constants"; | ||
import { APP_BRAND, BrandType } from "@app/Constants"; | ||
import logoRedHat from "@app/images/logoRedHat.svg"; | ||
import "./header.css"; | ||
|
||
export const HeaderApp: React.FC = () => { | ||
const toolbar = ( | ||
<PageHeaderTools> | ||
<PageHeaderToolsGroup | ||
visibility={{ | ||
default: "hidden", | ||
"2xl": "visible", | ||
xl: "visible", | ||
lg: "visible", | ||
md: "hidden", | ||
sm: "hidden", | ||
}} | ||
> | ||
<PageHeaderToolsItem> | ||
<AppAboutModalState> | ||
{({ toggleModal }) => { | ||
return ( | ||
<Button | ||
id="about-button" | ||
aria-label="about button" | ||
variant={ButtonVariant.plain} | ||
onClick={toggleModal} | ||
> | ||
<HelpIcon /> | ||
</Button> | ||
); | ||
}} | ||
</AppAboutModalState> | ||
</PageHeaderToolsItem> | ||
</PageHeaderToolsGroup> | ||
<PageHeaderToolsGroup> | ||
<PageHeaderToolsItem | ||
<Toolbar isFullHeight isStatic> | ||
<ToolbarContent> | ||
<ToolbarGroup | ||
variant="icon-button-group" | ||
align={{ default: "alignRight" }} | ||
spacer={{ default: "spacerNone", md: "spacerMd" }} | ||
visibility={{ | ||
lg: "hidden", | ||
}} /** this kebab dropdown replaces the icon buttons and is hidden for desktop sizes */ | ||
default: "hidden", | ||
"2xl": "visible", | ||
xl: "visible", | ||
lg: "visible", | ||
md: "hidden", | ||
}} | ||
> | ||
<MobileDropdown /> | ||
</PageHeaderToolsItem> | ||
<SSOMenu /> | ||
</PageHeaderToolsGroup> | ||
{APP_BRAND === BrandType.MTA && ( | ||
<PageHeaderToolsGroup> | ||
<PageHeaderToolsItem> | ||
<img src={logoRedHat} alt="Logo" className="redhat-logo-style" /> | ||
</PageHeaderToolsItem> | ||
</PageHeaderToolsGroup> | ||
<ToolbarItem> | ||
<AppAboutModalState> | ||
{({ toggleModal }) => { | ||
return ( | ||
<Button | ||
id="about-button" | ||
aria-label="about button" | ||
variant={ButtonVariant.plain} | ||
onClick={toggleModal} | ||
> | ||
<HelpIcon /> | ||
</Button> | ||
); | ||
}} | ||
</AppAboutModalState> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
<ToolbarGroup> | ||
<ToolbarItem | ||
visibility={{ | ||
lg: "hidden", | ||
}} /** this kebab dropdown replaces the icon buttons and is hidden for desktop sizes */ | ||
> | ||
<MobileDropdown /> | ||
</ToolbarItem> | ||
<SSOMenu /> | ||
</ToolbarGroup> | ||
{APP_BRAND === BrandType.MTA && ( | ||
<ToolbarGroup> | ||
<ToolbarItem> | ||
<img src={logoRedHat} alt="Logo" className="redhat-logo-style" /> | ||
</ToolbarItem> | ||
</ToolbarGroup> | ||
)} | ||
</ToolbarContent> | ||
</Toolbar> | ||
); | ||
return ( | ||
<Masthead> | ||
<MastheadToggle> | ||
<PageToggleButton variant="plain" aria-label="Global navigation"> | ||
<BarsIcon /> | ||
</PageToggleButton> | ||
</MastheadToggle> | ||
{APP_BRAND === BrandType.Konveyor ? ( | ||
<MastheadMain> | ||
<MastheadBrand> | ||
<Brand | ||
src={konveyorBrandImage} | ||
alt="brand" | ||
heights={{ default: "60px" }} | ||
/> | ||
</MastheadBrand> | ||
</MastheadMain> | ||
) : ( | ||
<MastheadContent> | ||
<Title className="logo-pointer" headingLevel="h1" size="2xl"> | ||
Migration Toolkit for Applications | ||
</Title> | ||
</MastheadContent> | ||
)} | ||
</PageHeaderTools> | ||
<MastheadContent>{toolbar}</MastheadContent> | ||
</Masthead> | ||
); | ||
|
||
const headerLogo = | ||
APP_BRAND === BrandType.Konveyor ? ( | ||
<Brand src={konveyorBrandImage} alt="brand" /> | ||
) : ( | ||
<Title className="logo-pointer" headingLevel="h1" size="2xl"> | ||
Migration Toolkit for Applications | ||
</Title> | ||
); | ||
|
||
return <PageHeader logo={headerLogo} headerTools={toolbar} showNavToggle />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.