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
adding custom width support to meter and progressbar #1560
Conversation
Build successful! 🎉 |
Build successful! 🎉 |
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.
Looks good in chrome/safari/ff on mac
@@ -18,15 +18,17 @@ governing permissions and limitations under the License. | |||
flex-flow: row wrap; | |||
justify-content: space-between; | |||
align-items: center; | |||
width: var(--spectrum-barloader-large-width); | |||
min-width: var(--spectrum-barloader-large-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.
Just wanna double check: did we check w/ spectrum regarding this min-width
here? I noticed that spectrum css has a min-width of 192px applied to their progress bars but only if it has a side label not if the label is on top. You can try it out by modifying the widths here
IMO we should def have a min-width so that weird label and number value stacking doesn't happen but do we want a smaller value? 192px feels kinda large. This is 100px:
'width: 30px, labelPosition: side, isIndeterminate: true', | ||
() => render({width: '30px', labelPosition: 'side', isIndeterminate: true}) |
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 think the css for the labelPosition: side
will need to account for the case in which the width applied is less than the min-width
. At the moment the wrapping div (.spectrum-BarLoader
) will be of width 192px, but that doesn't account for the label width and thus the following can happen when there are sibling elements (aka the button is hidden by the progress bar):
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 think spectrum-css styles might suffer from the same issue. Maybe a min-width: fit-content
and have the label have a max width so it calculates properly? Open to opinions for this one
Build successful! 🎉 |
Build successful! 🎉 |
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.
Overall looks fine to me, just one question though
&.spectrum-BarLoader--indeterminate { | ||
max-width: var(--spectrum-barloader-large-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.
Where did this come from?
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.
Indeterminate progress bars are locked to 192px until we change the animations to work with custom widths.
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.
gotcha, that should fine then
min-width: fit-content; | ||
|
||
.spectrum-BarLoader-track { | ||
width: auto; | ||
} |
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.
while one of these seems needed, where is this coming from?
also, line 70 has inline-size: auto
, which is width: auto
, i'm surprised it's needed for sideLabel and for track? lets be consistent and use inline-size
we can also use inline-size anywhere we have width, so min-width
-> min-inline-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.
So this line prevents the long label, labelPosition: side
story from having a track larger than 192px. I appears the track auto width without the auto width in the side label parent works just fine, so I'll remove that. And I'll update to inline-size. :)
Build successful! 🎉 |
@@ -18,15 +18,21 @@ governing permissions and limitations under the License. | |||
flex-flow: row wrap; | |||
justify-content: space-between; | |||
align-items: center; | |||
width: var(--spectrum-barloader-large-width); | |||
min-inline-size: var(--spectrum-barloader-large-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.
Do we really want to restrict the meter/progressbar size so that it must be greater than 192px?
I feel like we had discussed this before but I can't find that discussion anymore (and of course I resolved my own comment previously without adding details zzzz).
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 think this was at direction from Spectrum when this component was first created, but I can't find that historical knowledge.
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.
min width 48px in both scales. https://jira.corp.adobe.com/browse/SDS-5040
@@ -18,15 +18,27 @@ governing permissions and limitations under the License. | |||
flex-flow: row wrap; | |||
justify-content: space-between; | |||
align-items: center; | |||
width: var(--spectrum-barloader-large-width); | |||
min-inline-size: 48px; |
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.
DNA hasn't created a token so I'm using 48px. Is there a different token I should use?
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.
size-600 is 48px at medium
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.
used 600 static because they want 48px for medium and large scales.
Build successful! 🎉 |
() => render({width: '30px', labelPosition: 'side', label: 'Super long progress bar label. Sample label copy. Loading...'}) | ||
) | ||
.add( | ||
'width: 30px, labelPosition: side, isIndeterminate: true, long label, button on left', |
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.
button is on the right?
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.
fixed
Build successful! 🎉 |
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.
lgtm
Build successful! 🎉 |
I found a bug |
what's the bug? |
The track is 48px in this story, not 192px. indeterminate should always be 192px. It's now back so indeterminate is always 192px. I just pushed a fix. |
Build successful! 🎉 |
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.
gotcha, now it looks right
Why? It seems weird that indeterminate would have a different behavior from determinate. Especially if someone changed between them at runtime. |
@devongovett yep, I'd love for them to be any width too adobe/spectrum-css#497 |
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 going to merge this. Not sure how common the case of switching between indeterminate and determinate is, but we should follow up on that.
Closes #1192
Changed the width to min-width and added inline size.
✅ Pull Request Checklist:
📝 Test Instructions:
Goto the meter and/or progress bar stories
Check out the new width stories
Also check the other stories like side labels without width because that was a problem case when making the change.
🧢 Your Project:
RSP