Skip to content

Commit

Permalink
Module: Center the collapse/expand icon (#3142)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlingineni authored Aug 18, 2023
1 parent 7e38aab commit 392235a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/gestalt/src/Module/ExpandableItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ export default function ModuleExpandableItem({
)}
</Box>

{/* Adding a max height because the line height is 24, and we don't want the icon container to expand */}
{Boolean(children) && (
<Box id={id} padding={1}>
<Box id={id} padding={1} display="flex" alignItems="center" maxHeight={24}>
<Icon
accessibilityLabel={
isCollapsed ? accessibilityExpandLabel : accessibilityCollapseLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,13 @@ exports[`ModuleExpandableItem renders correctly with when expanded 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down
49 changes: 42 additions & 7 deletions packages/gestalt/src/__snapshots__/ModuleExpandable.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ exports[`Module Expandable renders correctly with multiple items 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID-0"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down Expand Up @@ -209,8 +214,13 @@ exports[`Module Expandable renders correctly with multiple items 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID-1"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down Expand Up @@ -346,8 +356,13 @@ exports[`Module Expandable renders correctly with multiple items 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID-2"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down Expand Up @@ -495,8 +510,13 @@ exports[`Module Expandable renders correctly with one item 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID-0"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down Expand Up @@ -591,8 +611,13 @@ exports[`renders correctly with multiple items with expandedId 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID-0"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down Expand Up @@ -711,8 +736,13 @@ exports[`renders correctly with multiple items with expandedId 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID-1"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down Expand Up @@ -848,8 +878,13 @@ exports[`renders correctly with multiple items with expandedId 1`] = `
</div>
</div>
<div
className="box paddingX1 paddingY1"
className="box paddingX1 paddingY1 xsDisplayFlex xsItemsCenter"
id="uniqueTestID-2"
style={
Object {
"maxHeight": 24,
}
}
>
<svg
aria-hidden={null}
Expand Down

0 comments on commit 392235a

Please sign in to comment.