Skip to content

Commit

Permalink
[web] Drop Agama/KebabMenu
Browse files Browse the repository at this point in the history
Because it became a dummy wrapper after the changes introduced to the
Dropdown comonent by PatternFly.

The only thing that might make some sense to extract (from
Agama/WifiNetworkMenu) is the custom toggler if we end up using it in
more places.
  • Loading branch information
dgdavid committed Sep 22, 2023
1 parent 12dc11f commit 211c2a4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 63 deletions.
10 changes: 4 additions & 6 deletions web/src/assets/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@ button.hidden-popover-button {
word-break: keep-all;
}

.wifi-network-menu {
button.toggler {
padding-inline-start: 0;
button.kebab-toggler {
padding-right: 0;

svg {
vertical-align: middle;
}
svg {
vertical-align: middle;
}
}

Expand Down
48 changes: 0 additions & 48 deletions web/src/components/core/KebabMenu.jsx

This file was deleted.

1 change: 0 additions & 1 deletion web/src/components/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export { default as IssuesLink } from "./IssuesLink";
export { default as IssuesPage } from "./IssuesPage";
export { default as SectionSkeleton } from "./SectionSkeleton";
export { default as LoadingEnvironment } from "./LoadingEnvironment";
export { default as KebabMenu } from "./KebabMenu";
export { default as LogsButton } from "./LogsButton";
export { default as FileViewer } from "./FileViewer";
export { default as RowActions } from "./RowActions";
Expand Down
27 changes: 19 additions & 8 deletions web/src/components/network/WifiNetworkMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,32 @@
* find current contact information at www.suse.com.
*/

import React from "react";
import { DropdownItem } from '@patternfly/react-core';
import React, { useState } from "react";
import { Dropdown, DropdownList, DropdownItem, MenuToggle } from '@patternfly/react-core';
import { Icon } from "~/components/layout";
import { KebabMenu } from "~/components/core";
import { useInstallerClient } from "~/context/installer";
import { _ } from "~/i18n";

const KebabToggle = ({ toggleRef, onClick }) => (
<MenuToggle ref={toggleRef} variant="plain" onClick={onClick} className="kebab-toggler">
<Icon name="more_vert" size="24" />
</MenuToggle>
);

export default function WifiNetworkMenu({ settings, position = "right" }) {
const client = useInstallerClient();
const [isOpen, setIsOpen] = useState(false);
const toggle = () => setIsOpen(!isOpen);

return (
<KebabMenu
<Dropdown
isOpen={isOpen}
onSelect={toggle}
toggle={(toggleRef) => <KebabToggle toggleRef={toggleRef} onClick={toggle} />}
popperProps={{ position }}
position={position}
className="wifi-network-menu"
items={[
>
<DropdownList>
<DropdownItem
key="forget-network"
onClick={() => client.network.deleteConnection(settings)}
Expand All @@ -43,7 +54,7 @@ export default function WifiNetworkMenu({ settings, position = "right" }) {
{/* TRANSLATORS: menu label, remove the selected WiFi network settings */}
{_("Forget network")}
</DropdownItem>
]}
/>
</DropdownList>
</Dropdown>
);
}

0 comments on commit 211c2a4

Please sign in to comment.