From d28f4f07846b4ec359920806b8c891c536ef1867 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Thu, 13 Feb 2025 16:28:24 +0100
Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Change=20hook=20props=20fr?=
=?UTF-8?q?om=20object=20to=20argument=20list?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../js/Components/ReusableComponents/AccordionSection.js | 2 +-
.../ppcp-settings/resources/js/hooks/useToggleState.js | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/AccordionSection.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/AccordionSection.js
index 379a16580..ca73ab531 100644
--- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/AccordionSection.js
+++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/AccordionSection.js
@@ -21,7 +21,7 @@ const Accordion = ( {
children = null,
className = '',
} ) => {
- const { isOpen, toggleOpen } = useToggleState( { id, initiallyOpen } );
+ const { isOpen, toggleOpen } = useToggleState( id, initiallyOpen );
const wrapperClasses = classNames( 'ppcp-r-accordion', className, {
'ppcp--is-open': isOpen,
} );
diff --git a/modules/ppcp-settings/resources/js/hooks/useToggleState.js b/modules/ppcp-settings/resources/js/hooks/useToggleState.js
index 030291e00..a1ee750cc 100644
--- a/modules/ppcp-settings/resources/js/hooks/useToggleState.js
+++ b/modules/ppcp-settings/resources/js/hooks/useToggleState.js
@@ -14,13 +14,12 @@ const determineInitialState = ( id, initiallyOpen ) => {
/**
* Allows managing a toggle-able component, such as an accordion or a modal dialog.
*
- * @param {Object} props
- * @param {string} props.id - Optional, if provided, the toggle can be opened via the URL.
- * @param {null|boolean} props.initiallyOpen - Optional. If provided, it defines the initial open state.
- * If omitted, the initial open state is determined by using the "id" logic (inspecting the URL).
+ * @param {string} [id=''] - If provided, the toggle can be opened via the URL.
+ * @param {null|boolean} [initiallyOpen=null] - If provided, it defines the initial open state.
+ * If omitted, the initial open state is determined by using the "id" logic (inspecting the URL).
* @return {{isOpen: unknown, toggleOpen: (function(*): boolean)}} Hook object.
*/
-export function useToggleState( { id = '', initiallyOpen = null } ) {
+export function useToggleState( id = '', initiallyOpen = null ) {
const [ isOpen, setIsOpen ] = useState(
determineInitialState( id, initiallyOpen )
);