Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga committed Nov 27, 2024
1 parent a4691d1 commit da2be25
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ export const useAccordionState = ({ navNode }: { navNode: ChromeProjectNavigatio
const getAccordionProps = useCallback(
(
path: string,
_accordionProps?: Partial<EuiAccordionProps>
accordionProps?: Partial<EuiAccordionProps>
): Partial<EuiAccordionProps> | undefined => {
const isCollapsed = accordionStateById[path]?.isCollapsed;
const isCollapsible = accordionStateById[path]?.isCollapsible;

if (isCollapsed === undefined) return _accordionProps; // No state set yet
if (isCollapsed === undefined) return accordionProps; // No state set yet

let forceState: EuiAccordionProps['forceState'] = isCollapsed ? 'closed' : 'open';
if (!isCollapsible) forceState = 'open'; // Allways open if the accordion is not collapsible
Expand All @@ -109,9 +109,8 @@ export const useAccordionState = ({ navNode }: { navNode: ChromeProjectNavigatio

const updated: Partial<EuiAccordionProps & { isCollapsible?: boolean }> = {
buttonProps: { 'data-test-subj': 'accordionToggleBtn' },
..._accordionProps,
...accordionProps,
arrowProps,
isCollapsible,
forceState,
onToggle: isCollapsible
? () => {
Expand Down

0 comments on commit da2be25

Please sign in to comment.