Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

fix(Dialog): make width responsive #2193

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Dec 17, 2019

Fixes #2139.

This PR adds media selectors for Dialog to make it responsible:

image

image

image

},
'@media (min-width: 1280px)': {
width: v.rootWidth,
},
Copy link
Member Author

Choose a reason for hiding this comment

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

@codepretty can you please provide proper breakpoints? 🙏

Copy link
Contributor

Choose a reason for hiding this comment

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

Trying to nail down the breakpoint logic with Design... Almost have it figured out.

@DustyTheBot
Copy link
Collaborator

DustyTheBot commented Dec 17, 2019

Perf comparison

Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🔧 Avatar.Fluent 0.55 0.37 1.49:1 2000 1107
🔧 Button.Fluent 1.26 0.17 7.41:1 1000 1261
🔧 Checkbox.Fluent 1.36 0.28 4.86:1 1000 1356
🔧 Dialog.Fluent 0.36 0.17 2.12:1 5000 1792
🔧 Dropdown.Fluent 3.62 0.38 9.53:1 1000 3617
🔧 Icon.Fluent 0.24 0.03 8:1 5000 1180
🔧 Image.Fluent 0.1 0.08 1.25:1 5000 495
🔧 Slider.Fluent 1.86 0.29 6.41:1 1000 1862
🦄 Text.Fluent 0.05 0.16 0.31:1 5000 258
🦄 Tooltip.Fluent 0.4 17.44 0.02:1 5000 2019

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
BoxMinimalPerf.default 290 244 1.19:1
CarouselMinimalPerf.default 2056 1820 1.13:1
HeaderSlotsPerf.default 1399 1269 1.1:1
Dialog.Fluent 1792 1627 1.1:1
AccordionMinimalPerf.default 197 182 1.08:1
AnimationMinimalPerf.default 463 434 1.07:1
ChatDuplicateMessagesPerf.default 595 554 1.07:1
RefMinimalPerf.default 174 163 1.07:1
Button.Fluent 1261 1184 1.07:1
Image.Fluent 495 461 1.07:1
TableMinimalPerf.default 616 583 1.06:1
Text.Fluent 258 243 1.06:1
AttachmentSlotsPerf.default 3449 3281 1.05:1
ButtonMinimalPerf.default 1498 1429 1.05:1
CustomToolbarPrototype.default 3928 3754 1.05:1
DividerMinimalPerf.default 962 925 1.04:1
ListCommonPerf.default 1112 1072 1.04:1
VideoMinimalPerf.default 651 623 1.04:1
ChatWithPopoverPerf.default 603 587 1.03:1
PortalMinimalPerf.default 246 239 1.03:1
ProviderMinimalPerf.default 574 558 1.03:1
Tooltip.Fluent 2019 1955 1.03:1
FlexMinimalPerf.default 366 359 1.02:1
GridMinimalPerf.default 778 765 1.02:1
ProviderMergeThemesPerf.default 1077 1057 1.02:1
TreeMinimalPerf.default 844 825 1.02:1
MenuButtonMinimalPerf.default 1406 1399 1.01:1
PopupMinimalPerf.default 372 369 1.01:1
FormMinimalPerf.default 750 749 1:1
IconMinimalPerf.default 1040 1039 1:1
ImageMinimalPerf.default 499 501 1:1
MenuMinimalPerf.default 1803 1798 1:1
RadioGroupMinimalPerf.default 373 372 1:1
TooltipMinimalPerf.default 2182 2194 0.99:1
Dropdown.Fluent 3617 3666 0.99:1
DropdownManyItemsPerf.default 515 523 0.98:1
ToolbarMinimalPerf.default 672 684 0.98:1
ButtonSlotsPerf.default 1807 1867 0.97:1
HierarchicalTreeMinimalPerf.default 722 747 0.97:1
InputMinimalPerf.default 984 1019 0.97:1
LayoutMinimalPerf.default 488 501 0.97:1
Checkbox.Fluent 1356 1402 0.97:1
Icon.Fluent 1180 1216 0.97:1
DialogMinimalPerf.default 1809 1878 0.96:1
LoaderMinimalPerf.default 2374 2480 0.96:1
CheckboxMinimalPerf.default 6842 7169 0.95:1
DropdownMinimalPerf.default 3699 3904 0.95:1
ItemLayoutMinimalPerf.default 1562 1650 0.95:1
LabelMinimalPerf.default 1679 1760 0.95:1
SegmentMinimalPerf.default 1408 1477 0.95:1
TextMinimalPerf.default 250 264 0.95:1
Avatar.Fluent 1107 1165 0.95:1
Slider.Fluent 1862 1955 0.95:1
AlertMinimalPerf.default 521 557 0.94:1
ListMinimalPerf.default 635 672 0.94:1
HeaderMinimalPerf.default 409 441 0.93:1
SplitButtonMinimalPerf.default 12475 13548 0.92:1
ReactionMinimalPerf.default 2627 2884 0.91:1
AttachmentMinimalPerf.default 884 980 0.9:1
SliderMinimalPerf.default 1997 2224 0.9:1
EmbedMinimalPerf.default 6252 7021 0.89:1
TextAreaMinimalPerf.default 2817 3180 0.89:1
StatusMinimalPerf.default 835 960 0.87:1
ChatMinimalPerf.default 1618 1889 0.86:1
AvatarMinimalPerf.default 578 771 0.75:1

Generated by 🚫 dangerJS

rootWidthLarge: '50vw',
rootWidthLargeBreakpoint: '@media (min-width: 1280px)',
rootWidthMedium: '75vw',
rootWidthBreakpointMedium: '@media (min-width: 768px)',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rootWidthBreakpointMedium: '@media (min-width: 768px)',
rootWidthMediumBreakpoint: '@media (min-width: 768px)',


rootWidth: '90vw',
rootWidthLarge: '50vw',
rootWidthLargeBreakpoint: '@media (min-width: 1280px)',
Copy link
Contributor

Choose a reason for hiding this comment

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

I am kind a leaning more towards allowing users to specify only the px value here, not the whole string, but I am not sure. We should make that decision now, as this is the first PR that is adding breakpoints

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure that we should limit user there as media queries support a lot of attributes:
https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries

@@ -16,6 +16,13 @@ export default {
gridTemplateColumns: '1fr auto',
boxShadow: v.boxShadow,
color: v.foregroundColor,

[v.rootWidthBreakpointMedium]: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we check whether it is defined first?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's required by typings. Why we need to have additional checks there?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧰 fix Introduces fix for broken behavior. 🚀 ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<Dialog /> not responsive on smaller viewports
4 participants