Skip to content

Commit

Permalink
Merge pull request #2067 from system-ui/lachlanjc-switch-flex-shrink
Browse files Browse the repository at this point in the history
components: Fix visual collapsing bug with Switch component
  • Loading branch information
hasparus authored Jan 13, 2022
2 parents cb21246 + b5ac609 commit 02658ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/components/src/Switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const Switch = React.forwardRef(function Switch(
sx={sx}
__css={{
position: 'relative',
flexShrink: 0,
bg: 'gray',
borderRadius: SIZE,
height: SIZE + GUTTER * 2,
Expand Down Expand Up @@ -64,7 +65,8 @@ export const Switch = React.forwardRef(function Switch(
transform: 'translateX(100%)',
},
},
}}>
}}
>
<Box />
</Box>
<span>{label}</span>
Expand Down
3 changes: 3 additions & 0 deletions packages/components/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,9 @@ exports[`Switch renders 1`] = `
margin: 0;
min-width: 0;
position: relative;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
background-color: gray;
border-radius: 18px;
height: 22px;
Expand Down

0 comments on commit 02658ae

Please sign in to comment.