Skip to content

Commit 3d3b102

Browse files
authored
Change the way child items are hidden in the sidebar (#23159)
1 parent 1d83e04 commit 3d3b102

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

www/src/components/sidebar/accordion.js

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -139,42 +139,43 @@ class Accordion extends React.Component {
139139
uid={uid}
140140
disableAccordions={disableAccordions}
141141
/>
142-
<ul
143-
id={uid}
144-
sx={{
145-
display: isExpanded ? `block` : `none`,
146-
listStyle: `none`,
147-
margin: 0,
148-
position: `relative`,
149-
...(item.ui === `steps` && {
150-
"&:after": {
151-
backgroundColor: `ui.border`,
152-
bottom: 0,
153-
content: `''`,
154-
left: 27,
155-
position: `absolute`,
156-
top: 0,
157-
width: 1,
158-
},
159-
}),
160-
}}
161-
>
162-
{item.items.map(subitem => (
163-
<Item
164-
activeItemLink={activeItemLink}
165-
activeItemParents={activeItemParents}
166-
createLink={createLink}
167-
item={subitem}
168-
key={subitem.title}
169-
location={location}
170-
onLinkClick={onLinkClick}
171-
isExpanded={isExpanded}
172-
onSectionTitleClick={onSectionTitleClick}
173-
openSectionHash={openSectionHash}
174-
ui={item.ui}
175-
/>
176-
))}
177-
</ul>
142+
{isExpanded && (
143+
<ul
144+
id={uid}
145+
sx={{
146+
listStyle: `none`,
147+
margin: 0,
148+
position: `relative`,
149+
...(item.ui === `steps` && {
150+
"&:after": {
151+
backgroundColor: `ui.border`,
152+
bottom: 0,
153+
content: `''`,
154+
left: 27,
155+
position: `absolute`,
156+
top: 0,
157+
width: 1,
158+
},
159+
}),
160+
}}
161+
>
162+
{item.items.map(subitem => (
163+
<Item
164+
activeItemLink={activeItemLink}
165+
activeItemParents={activeItemParents}
166+
createLink={createLink}
167+
item={subitem}
168+
key={subitem.title}
169+
location={location}
170+
onLinkClick={onLinkClick}
171+
isExpanded={isExpanded}
172+
onSectionTitleClick={onSectionTitleClick}
173+
openSectionHash={openSectionHash}
174+
ui={item.ui}
175+
/>
176+
))}
177+
</ul>
178+
)}
178179
</li>
179180
)
180181
}

0 commit comments

Comments
 (0)