-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
170 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (C) 2022 Red Hat, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 2.1 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with This program; If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React, { useState, useEffect } from "react"; | ||
import { | ||
AboutModal, | ||
Button, | ||
Flex, | ||
TextContent, | ||
TextList, | ||
TextListItem, | ||
} from "@patternfly/react-core"; | ||
import { ExternalLinkAltIcon } from "@patternfly/react-icons"; | ||
import { getAnacondaVersion } from "../helpers/product"; | ||
import "../components/app.scss"; | ||
|
||
export const AnacondaAboutModal = ({ isModalOpen, setIsAboutModalOpen }) => { | ||
const toggleModal = () => { | ||
setIsAboutModalOpen(!isModalOpen); | ||
}; | ||
|
||
const [anacondaVersion, setAnacondaVersion] = useState(""); | ||
|
||
useEffect(() => { | ||
getAnacondaVersion().then(content => | ||
setAnacondaVersion(content.split(" ").slice(-1)[0].replace("\n", "")) | ||
); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<AboutModal | ||
style={{ marginTop: "0" }} | ||
isOpen={isModalOpen} | ||
onClose={toggleModal} | ||
trademark="© 2023 Red Hat, Inc." | ||
productName="Red Hat Enterprise Linux 9 installer" | ||
> | ||
<TextContent className="pf-u-py-xl" style={{ marginBottom: "48px" }}> | ||
<h1>Powered by Anaconda</h1> | ||
</TextContent> | ||
<TextContent /> | ||
<TextContent> | ||
<TextList component="dl" style={{ fontSize: "large" }}> | ||
<TextListItem component="dt">Anaconda</TextListItem> | ||
<TextListItem component="dd">{anacondaVersion}</TextListItem> | ||
<TextListItem component="dt">Blivet</TextListItem> | ||
<TextListItem component="dd">XXX</TextListItem> | ||
<TextListItem component="dt">Pykickstart</TextListItem> | ||
<TextListItem component="dd">XXX</TextListItem> | ||
<TextListItem component="dt">Python</TextListItem> | ||
<TextListItem component="dd">XXX</TextListItem> | ||
</TextList> | ||
</TextContent> | ||
<Flex style={{ marginTop: "13rem", position: "static" }}> | ||
<Button variant="link" icon={<ExternalLinkAltIcon />} style={{ paddingLeft: "0" }}> | ||
Anaconda project page | ||
</Button>{" "} | ||
<Button variant="link" icon={<ExternalLinkAltIcon />}> | ||
Report a bug | ||
</Button> | ||
</Flex> | ||
</AboutModal> | ||
</> | ||
); | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2022 Red Hat, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 2.1 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with This program; If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React, { useState } from "react"; | ||
import { Dropdown, DropdownItem, DropdownSeparator, DropdownPosition, KebabToggle } from "@patternfly/react-core"; | ||
import { AnacondaAboutModal } from "./AnacondaAboutModal"; | ||
|
||
export const HeaderKebab = () => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
const [isAboutModalOpen, setIsAboutModalOpen] = useState(false); | ||
|
||
const onToggle = isOpen => { | ||
setIsOpen(isOpen); | ||
}; | ||
const onFocus = () => { | ||
const element = document.getElementById("toggle-kebab"); | ||
element.focus(); | ||
}; | ||
const onSelect = () => { | ||
setIsOpen(false); | ||
onFocus(); | ||
}; | ||
|
||
const handleAboutModal = () => { | ||
setIsAboutModalOpen(true); | ||
}; | ||
|
||
const dropdownItems = [ | ||
<DropdownItem key="action" component="button"> | ||
Documentation | ||
</DropdownItem>, | ||
<DropdownSeparator key="separator" />, | ||
<DropdownItem key="separated link" onClick={handleAboutModal}> | ||
About | ||
</DropdownItem>, | ||
]; | ||
return ( | ||
<> | ||
<Dropdown | ||
position={DropdownPosition.right} | ||
onSelect={onSelect} | ||
toggle={ | ||
<KebabToggle | ||
id="toggle-kebab" | ||
onToggle={onToggle} | ||
/> | ||
} | ||
isOpen={isOpen} | ||
isPlain | ||
dropdownItems={dropdownItems} | ||
/> | ||
{isAboutModalOpen && | ||
<AnacondaAboutModal | ||
isModalOpen={isAboutModalOpen} | ||
setIsAboutModalOpen={setIsAboutModalOpen} | ||
/>} | ||
</> | ||
|
||
); | ||
}; |
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
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