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

[FormLayout] min-width added to Item only when in Group. #650

Merged
merged 1 commit into from
Nov 21, 2018
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
2 changes: 2 additions & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

### Bug fixes

- Removed min-width from `FormLayout` `Items` and applying it only to `Items` used inside a `FormLayout.Group` ([#650](https://github.com/Shopify/polaris-react/pull/650))

### Documentation

### Development workflow
15 changes: 9 additions & 6 deletions src/components/FormLayout/FormLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ $item-min-size: rem(220px);
margin-left: -1 * spacing(loose);
}

.condensed .Item {
flex-basis: (0.5 * $item-min-size);
min-width: (0.5 * $item-min-size);
}

.Title {
margin-bottom: -1 * spacing(tight);
padding: spacing() spacing(loose) 0;
Expand All @@ -29,6 +24,14 @@ $item-min-size: rem(220px);
flex: 1 1 $item-min-size;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opted to keep the flex-basis as part of the Item to minimize the change.

margin-top: spacing();
margin-left: spacing(loose);
min-width: $item-min-size;
max-width: calc(100% - #{spacing(loose)});

.grouped & {
min-width: $item-min-size;
}

.condensed & {
flex-basis: (0.5 * $item-min-size);
Copy link
Member

Choose a reason for hiding this comment

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

Why .5? Should we save this to a variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was like this so I opted not to touch it. It's only used once so I don't see an issue with it. Do you?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine as is. I think this pretty clearly communicates that it is half the item min size.

Copy link
Contributor

@danrosenthal danrosenthal Nov 21, 2018

Choose a reason for hiding this comment

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

We do the same thing with * -1 to make a number negative. We don't add variables for that

min-width: (0.5 * $item-min-size);
}
}
2 changes: 1 addition & 1 deletion src/components/FormLayout/components/Group/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface Props {
const getUniqueID = createUniqueIDFactory('FormLayoutGroup');

export default function Group({children, condensed, title, helpText}: Props) {
const className = classNames(condensed && styles.condensed);
const className = classNames(condensed ? styles.condensed : styles.grouped);

const id = getUniqueID();

Expand Down