-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
RangeControl: Update the default marks styles to match the padding/margin control #67611
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,10 @@ export const Track = styled.span` | |
margin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px; | ||
top: 0; | ||
|
||
@media not ( prefers-reduced-motion ) { | ||
transition: width ease 0.1s; | ||
} | ||
|
||
${ trackBackgroundColor }; | ||
`; | ||
|
||
|
@@ -139,28 +143,18 @@ export const MarksWrapper = styled.span` | |
position: relative; | ||
width: 100%; | ||
user-select: none; | ||
margin-top: 17px; | ||
`; | ||
|
||
const markFill = ( { disabled, isFilled }: RangeMarkProps ) => { | ||
let backgroundColor = isFilled ? 'currentColor' : COLORS.gray[ 300 ]; | ||
|
||
if ( disabled ) { | ||
backgroundColor = COLORS.gray[ 400 ]; | ||
} | ||
|
||
return css( { | ||
backgroundColor, | ||
} ); | ||
}; | ||
|
||
export const Mark = styled.span` | ||
height: ${ thumbSize }px; | ||
left: 0; | ||
position: absolute; | ||
top: 9px; | ||
width: 1px; | ||
|
||
${ markFill }; | ||
left: 0; | ||
top: -4px; | ||
height: 4px; | ||
width: 2px; | ||
transform: translateX( -50% ); | ||
background-color: ${ COLORS.white }; | ||
youknowriad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
z-index: 1; | ||
`; | ||
|
||
const markLabelFill = ( { isFilled }: RangeMarkProps ) => { | ||
|
@@ -207,6 +201,11 @@ export const ThumbWrapper = styled.span` | |
user-select: none; | ||
width: ${ thumbSize }px; | ||
border-radius: ${ CONFIG.radiusRound }; | ||
z-index: 3; | ||
|
||
@media not ( prefers-reduced-motion ) { | ||
transition: left ease 0.1s; | ||
} | ||
Comment on lines
+206
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This animation introduces a subtle delay when dragging the thumb that can make the UI feel unresponsive. We could consider removing it for the time being, and focus this PR on updating the marks design. (also, in the block editor "custom" version, this animation was only applied when the is-marked class is applied — just noting in case that was deliberate) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The animation already exists in padding/margin so removing it could be seen as a regression in the behavior of the component. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jasmussen should we remove the animation or keep it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it — I will then propose that we keep the animation only when the component is showing marks (like it was in the deleted code from |
||
|
||
${ thumbColor }; | ||
${ rtl( { marginLeft: -10 } ) }; | ||
|
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 this animation is there to go hand in hand with the thumb's animation — we should remove it if we remove the thumb's animation.
(sidenote: animating the
width
is not very performant, and can cause the UI to feel sluggish instead of polishing the animation).If were to keep the animation around, we could add a comment to help future readers understand that the track and thumb animations go hand in hand.