-
Notifications
You must be signed in to change notification settings - Fork 1.3k
(RSP-1526) Moving size prop into DialogTrigger and css fixes for fullscreen dialog #229
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
|
Build successful! 🎉 |
|
Build successful! 🎉 |
packages/@react-spectrum/dialog/stories/DialogTrigger.stories.tsx
Outdated
Show resolved
Hide resolved
| 'type: popover, fullscreen', | ||
| () => render({type: 'popover', size: 'fullscreen'}) | ||
| ) | ||
| .add( |
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.
this one seems weird, same question
packages/@react-spectrum/dialog/stories/DialogTrigger.stories.tsx
Outdated
Show resolved
Hide resolved
| 'with hero, isDimissable', | ||
| () => renderHero({isDismissable: true, onDismiss: action('dismissed')}) | ||
| ) | ||
| .add( |
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.
can we not specify these anymore? (S/M/L)
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.
I'll readd
| 'form', | ||
| () => renderWithForm({}) | ||
| ) | ||
| .add( |
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.
this needs to be added somewhere, it's a good story to demonstrate tabbing order
| .spectrum-Dialog--fullscreen { | ||
| width: calc(100vw - 32px); | ||
| height: calc(100vh - 32px); | ||
| width: calc(100vw - 64px); |
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.
where does 64 come from? should it change with scale?
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.
32px is the padding that is supposed to be around the fullscreen dialog. Since that padding is 32px for both top/bottom and left/right, the above needed to get doubled so it actually fit the 32px padding container
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.
Not sure if it should change with scale, didn't see fullscreen in the XD designs, I'll ask around
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.
Updated to 40px constant as per design: https://excelerate-team.slack.com/archives/G8R3V30FL/p1582920957021300
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| .spectrum-Dialog--fullscreen { | ||
| width: calc(100vw - 32px); | ||
| height: calc(100vh - 32px); | ||
| width: calc(100vw - 80px); |
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.
calc 2* fullscreen margin?
|
Build successful! 🎉 |
|
|
||
| /* Distance between top and bottom of dialog and edge of window for fullscreen dialog */ | ||
| --spectrum-dialog-fullscreen-margin: 32px; | ||
| --spectrum-dialog-fullscreen-margin: 40px; |
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.
Is there a common place for components/dialog/index.css and this file to share this variable?
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.
Ideally I would've included it into the css var but Larry said that file was autogenerated and to put new vars at the top of the index.css file.
|
Build successful! 🎉 |
Codecov Report
@@ Coverage Diff @@
## master #229 +/- ##
=========================================
Coverage ? 70.58%
=========================================
Files ? 206
Lines ? 3977
Branches ? 848
=========================================
Hits ? 2807
Misses ? 587
Partials ? 583
|
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| mobileType = type === 'popover' ? 'modal' : type, | ||
| hideArrow, | ||
| targetRef, | ||
| size, |
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.
Instead of adding a size prop to this, can we take advantage of type? We could have types: modal, popover, tray, fullscreen, fullscreenTakeover.
Make sense?
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.
Can you also add those 2 new types to mobileType. We want to allow people to override some default behaviors regarding mobile views.
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.
Ehh, I considered this before and it feels weird to me since it dilutes the intuitive meaning of the type prop. To me type indicates the kinda of shape/look of the Dialog where the size prop is its literal meaning. This would mean a user could provide a size to dialog (S/M/L) and specify type=fullscreen as well which doesn't really make sense as a pairing
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.
If we are trying to distinguish that fullscreen/fullscreenTakeover is for modal only, we could go one step further and change size to be modalSize since it only really applies to the modal type as is.
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.
yeah mostly the problem here is that DialogTrigger handles too much anyway. The situation you describe will exist anyway in other forms because we are mixing popover and modal behaviors. We will need in on mobileType so it seemed the best to just add it to type as well. Otherwise based on your suggestion we would need modalSize and mobileModalSize?
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.
yup we would need to add mobileModalSize as well in case the user wants separate size behavior on mobile vs desktop.
I'll go with your suggestion for now and add the 2 fullscreen types
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.
ok cool
|
Build successful! 🎉 |
|
Build successful! 🎉 |
Closes https://jira.corp.adobe.com/browse/RSP-1526
✅ Pull Request Checklist:
📝 Test Instructions: