Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move flex-shrink: 0 to BaseVisualContainer. #1596

Merged
merged 3 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/grumpy-tomatoes-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': patch
---

Fix alignment of items in ActionList (single-select) if some of the items have wrapping text.
2 changes: 1 addition & 1 deletion src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ const BaseVisualContainer = styled.div<{variant?: ItemProps['variant']; disabled
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this change, I think we could move the flex-shrink: 0 to an sx prop on the <BaseVisualContainer /> used in <Item /> for single-select action lists, but this seemed like a more correct fix.

Happy to switch to the more targeted approach if we feel like it is safer.

`

const ColoredVisualContainer = styled(BaseVisualContainer)`
Expand All @@ -285,7 +286,6 @@ const ColoredVisualContainer = styled(BaseVisualContainer)`
`

const LeadingVisualContainer = styled(ColoredVisualContainer)`
flex-shrink: 0;
display: flex;
flex-direction: column;
justify-content: center;
Expand Down
9 changes: 9 additions & 0 deletions src/__tests__/__snapshots__/Autocomplete.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ Array [
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}

.c10 {
Expand Down Expand Up @@ -1375,6 +1378,9 @@ Array [
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}

.c6 rect {
Expand Down Expand Up @@ -2192,6 +2198,9 @@ Array [
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}

.c10 rect {
Expand Down