-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
(Custom)GradientPicker: Add flag to remove margins #43387
Conversation
Size Change: -12 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
.components-custom-gradient-picker__gradient-bar { | ||
margin: $grid-unit-20 0 $grid-unit-15; | ||
} |
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.
margin-top: $grid-unit-15; | ||
width: 100%; | ||
height: $grid-unit-60; | ||
margin-bottom: $grid-unit-20+$grid-unit-05; |
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 CustomGradientBar is an internal-only component, we fully remove these margins, and let the publicly exported consumer components handle the back compat concerns.
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.
😎
.components-custom-gradient-picker { | ||
&:not(.is-next-has-no-margin) { | ||
margin-top: $grid-unit-15; | ||
margin-bottom: $grid-unit-30; |
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.
$grid-unit-30
here is the $grid-unit-20
from components-custom-gradient-picker__ui-line
plus the $grid-unit-10
from the bottom margin on AnglePickerControl.
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.
It looks like AnglePickerControl
has the __nextHasNoMarginBottom
prop always set to true
, how does it contribute to the margin bottom ?
Kapture.2022-08-18.at.20.10.41.mp4
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.
We could've said margin-bottom: $grid-unit-20
on L6 and passed __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
to AnglePickerControl, and it would have the same effect. I just merged those two things into a single margin-bottom: $grid-unit-30
back compat at the top-level.
cc @ntsekouras — since we were talking about this earlier today! Here's an example of the effort that we're going through in the components package to remove outer margins from components |
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.
Thank you for working on this! 🚀
Bonus 👏 for the refactor to controls, some layout cleanup (using Spacer
and VStack
) and the move of CustomGradientBar
's folder.
.components-custom-gradient-picker { | ||
&:not(.is-next-has-no-margin) { | ||
margin-top: $grid-unit-15; | ||
margin-bottom: $grid-unit-30; |
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.
It looks like AnglePickerControl
has the __nextHasNoMarginBottom
prop always set to true
, how does it contribute to the margin bottom ?
Kapture.2022-08-18.at.20.10.41.mp4
margin-top: $grid-unit-15; | ||
width: 100%; | ||
height: $grid-unit-60; | ||
margin-bottom: $grid-unit-20+$grid-unit-05; |
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.
😎
@@ -117,6 +120,11 @@ export default function GradientPicker( { | |||
? MultipleOrigin | |||
: SingleOrigin; | |||
|
|||
// Can be removed when deprecation period is over |
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.
⏳
b970633
to
40f8746
Compare
Part of #39358 #43014
What?
__nextHasNoMargin
flag on CustomGradientPicker/GradientPicker to remove top and bottom margins.components-custom-gradient-picker__gradient-bar
, which indicates that it was never ready to be a standalone component.)Why?
For better reusability.
How?
Testing Instructions
npm run storybook:dev
Screenshots or screencast
CleanShot.2022-08-18.at.19.23.47.mp4