@@ -34,7 +34,7 @@ export interface ExpandableListItemProps extends BaseProps {
34
34
readonly expandedItems : ReadonlyArray < string >
35
35
readonly setExpandedItems : Dispatch < SetStateAction < ReadonlyArray < string > > >
36
36
readonly isNestedItem : boolean
37
- readonly isAccordion : boolean
37
+ readonly accordion ? : boolean
38
38
}
39
39
40
40
/**
@@ -51,7 +51,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
51
51
expandedItems,
52
52
setExpandedItems,
53
53
isNestedItem,
54
- isAccordion ,
54
+ accordion = false ,
55
55
...props
56
56
} ) => {
57
57
const { id, label, icon, selected = false , onClick, items } = item
@@ -63,7 +63,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
63
63
if ( expandedItems . includes ( itemId ) ) {
64
64
// Close the expanded item
65
65
nextExpandedItems = expandedItems . filter ( i => i !== itemId )
66
- } else if ( isAccordion ) {
66
+ } else if ( accordion ) {
67
67
// Only add one expanded item when accordion
68
68
nextExpandedItems = [ id ]
69
69
} else {
@@ -73,7 +73,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
73
73
74
74
setExpandedItems ( nextExpandedItems )
75
75
} ) ( id ) ,
76
- [ expandedItems , id , isAccordion , setExpandedItems ]
76
+ [ expandedItems , id , accordion , setExpandedItems ]
77
77
)
78
78
const hasChildren = items !== undefined
79
79
const onItemClick = hasChildren ? onChildClick : onClick
@@ -105,7 +105,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
105
105
expandedItems = { expandedItems }
106
106
setExpandedItems = { setExpandedItems }
107
107
isNestedItem = { true }
108
- isAccordion = { isAccordion }
108
+ accordion = { accordion }
109
109
/>
110
110
) ) }
111
111
</ ExpandableListContainer >
0 commit comments