-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[WIP][DropZone] Allow fixed height on DropZone #1138
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
Conversation
@dleroux @ry5n @danrosenthal I'm tagging you all to discuss the options that this PR produces and to also make sure I didn't miss anything in my notes above about the options. Happy to also keep looking into solutions for this in the meantime! Thank you. |
Hi @elizabethletourneau! @StephPoce talked about this issue today. I just want to let you know that I'll take a look at that from a design perspective. Let me organize my next few days and all the catch up after vacation. |
So I took a look at the related issues, and @elizabethletourneau helped me to understand a bit more of the problem (thank you, Liz! <3) Taking in consideration the fact that I thought that maybe there’s an opportunity here to add some guidelines to the style guide in how to do centralize it horizontally once you customize the height of the drop zone. Unrelated question: I was playing with the props and tried the |
2b6f8c5
to
98c2440
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good 😄 Left a few small comments but if we're 👌 from a design perspective this should be almost ready to ship since Dan, Solona and myself all gave 👍 on #908 and these pr's are almost identical
UNRELEASED.md
Outdated
|
||
### Bug fixes | ||
|
||
Constrain DropZone height based on inherited wrapper height (#1138)[https://github.com/Shopify/polaris-react/pull/1138] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constrain DropZone height based on inherited wrapper height (#1138)[https://github.com/Shopify/polaris-react/pull/1138] | |
- Constrain DropZone height based on inherited wrapper height ([#1138](https://github.com/Shopify/polaris-react/pull/1138)) |
src/components/DropZone/DropZone.tsx
Outdated
node: React.RefObject<HTMLDivElement>, | ||
) => { | ||
let wrapperSize = Size.ExtraLarge; | ||
const getSize = size === 'height' ? 'height' : 'width'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this inside the if statement since it's not used outside?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
src/components/DropZone/DropZone.tsx
Outdated
wrapperSize = Size.Medium; | ||
} else if (wrapper < Size.Large) { | ||
wrapperSize = Size.Large; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the default is ExtraLarge
we can 🔥 the else statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 🔥 🔥
bd9b760
to
8923025
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩 ✅ cc/ @mirualves for design 👀
UNRELEASED.md
Outdated
- Fixed selected state for date picker in windows high contrast mode ([#1342](https://github.com/Shopify/polaris-react/pull/1342)) | ||
- Added background into media query for Microsoft high contrast to fix skeleton accessibility. ([#1341](https://github.com/Shopify/polaris-react/pull/1341)) | ||
- Fixed the position calculation of the `PositionedOverlay` component after scroll. ([#1382](https://github.com/Shopify/polaris-react/pull/1382)) | ||
Constrain DropZone height based on inherited wrapper height ([#1138](https://github.com/Shopify/polaris-react/pull/1138)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constrain DropZone height based on inherited wrapper height ([#1138](https://github.com/Shopify/polaris-react/pull/1138)) | |
- Constrain DropZone height based on inherited wrapper height ([#1138](https://github.com/Shopify/polaris-react/pull/1138)) |
Hey @AndrewMusgrave, should I rebase and merge this, or are we still looking for design input first? |
I think we're fine on the design, @chloerice ! |
699dba0
to
0a01df2
Compare
@chloerice I just rebased and tests are failing. Any idea what changed? I can dig into it but just wondering if you knew before spending too much time on this. |
Tests started failing after my rebase as well. I haven't been successful in finding what's going on since the rebase, was digging into the higher priority issue. I'll be looking at this again Wednesday morning, but feel free to poke at it in the meantime! |
I've rebased this and fixed tests. @mirualves you're good with the Percy changes? @dpersing note the a11y issues. What's the recommendation here? |
@dleroux Let's investigate why it's affecting the spacing between the illustration, button and hint text. Ideally, it should have the same spacing as before. |
I checked the spacing @mirualves and the Stack is behaving correctly. The new dimensions are what is causing it so I think it's fine. |
Now that label is always required something is broken with the height. |
@dleroux Are you referencing automated tests (which are passing now, it looks), or the a11y issues logged against the component? |
Yes @dpersing. Sorry I figured it out. The accessibility fix (always having a label) is what breaks the visual layout right now. |
This PR has been open for about 6 months, I'm thinking we ought to close it until someone can commit to this change and see it through. |
You see an issue with leaving it open? I'm ok with closing this but I just worry it might be completely forgotten. |
@danrosenthal @daniedleroux Closing the PR should be okay if the associated issue remains open? |
WHY are these changes introduced?
Resolves #742
UPDATE:
When a height is specified the consumer will need to also adjust the horizontal alignment of anything they put within the
DropZone
(including aFileUpload
component.)The
DropZone
determines its size (height and width) based on width only. This makes certain valid use cases, where the defaultDropZone
height isn't appropriate, impossible.Important Notes - Needs Discussion
This PR was originally merged #908 however there was an issue with putting a flex on
Dropzone_Container
which caused DropZone.FileUpload to centre horizontally however this didn't take into account the fact that DropZone could have other children.What is up for discussion is that when a fixed height is given to the DropZone should it be up to the consumer to style DropZone's children or should we have two conditions, one that takes into account if FileUpload is the only child (therefore center it ) and the other being do not center FileUpload when there are multiple children.
There is also the fix Dan R. proposes here which adds a prop that center-aligns children and defaults to true.
WHAT is this pull request doing?
This pull request allows the consumer to set a fixed height on a wrapping parent element so that the
DropZone
takes its parent's height if one is provided.Current Behaviour: (wrapped with a div given a height of 50px)

New Behaviour: (wrapped with a div given a height of 50px)

(Note: there are in between size variations (ie. small width, medium height etc.) The
FileUpload
will always render the smaller measurement of width or height.How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Example of All Dropzone Possibilities
🎩 checklist