From 1daf2a94f4ef3ae4a038ce3ded3eec77735941e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Fri, 21 Apr 2023 08:36:03 +0100 Subject: [PATCH 01/23] [web] Rename the layout slot for app actions Basically used by the Sidebar, which will stop holding "Page" or "Contextual" actions. Another slot will be created for them in order to make these actions more discoverable. --- web/src/components/core/Sidebar.jsx | 6 +++--- web/src/components/layout/Layout.jsx | 17 +++++++++++++++-- web/src/test-utils.js | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/web/src/components/core/Sidebar.jsx b/web/src/components/core/Sidebar.jsx index d25e343e88..f82f0f706f 100644 --- a/web/src/components/core/Sidebar.jsx +++ b/web/src/components/core/Sidebar.jsx @@ -21,7 +21,7 @@ import React, { useEffect, useRef, useState } from "react"; import { Button, Text } from "@patternfly/react-core"; -import { Icon, PageActions } from "~/components/layout"; +import { Icon, AppActions } from "~/components/layout"; // FIXME: look for a better way to allow opening the Sidebar from outside let openButtonRef = {}; @@ -89,7 +89,7 @@ const Sidebar = ({ children }) => { return ( <> - + - + ); -}; - -/** - * Button for opening the sidebar - * @component - * - * @param {object} props - * @param {onClickFn} [props.onClick] - On click callback - * @param {React.ReactElement} props.children - */ -Sidebar.OpenButton = ({ onClick: onClickProp, children }) => { - const onClick = () => { - if (onClickProp !== undefined) onClickProp(); - openButtonRef.current.click(); - }; - - return ; -}; - -export default Sidebar; +} From 390329e4bc1be0d650a3cc181d1ddd6ddd400ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Mon, 24 Apr 2023 15:12:28 +0100 Subject: [PATCH 18/23] [web] Add documentation and test for ContextualActions --- web/src/components/core/ContextualActions.jsx | 65 ++++++++++++++++ .../core/ContextualActions.test.jsx | 76 +++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 web/src/components/core/ContextualActions.test.jsx diff --git a/web/src/components/core/ContextualActions.jsx b/web/src/components/core/ContextualActions.jsx index 8b9464970e..7e3395fb76 100644 --- a/web/src/components/core/ContextualActions.jsx +++ b/web/src/components/core/ContextualActions.jsx @@ -23,6 +23,13 @@ import React, { useState } from 'react'; import { Button, Dropdown, DropdownItem, DropdownGroup } from '@patternfly/react-core'; import { Icon, ContextualActions as ContextualActionsSlot } from "~/components/layout"; +/** + * Internal component to build the {ContextualActions} toggler + * @component + * + * @param {object} props + * @param {function} props.onClick + */ const Toggler = ({ onClick }) => { return (