fix: value length at progress bar when unit is percentage#7440
Merged
fix: value length at progress bar when unit is percentage#7440
Conversation
Refs: #7397 # Conflicts: # packages/components/src/components/progress/shadow.tsx
Contributor
There was a problem hiding this comment.
PR Overview
This PR fixes the progress bar’s value length display issue for percentage-based progress indicators and updates the sample usage to better demonstrate the component’s behavior.
- Adjusts the width calculation logic in KolProgress for percentage values.
- Updates sample values in ProgressBasic to illustrate different progress scenarios.
Reviewed Changes
| File | Description |
|---|---|
| packages/samples/react/src/components/progress/basic.tsx | Updated sample progress values to demonstrate progress with percentages and custom units. |
| packages/components/src/components/progress/shadow.tsx | Modified width calculation for the progress bar value to account for percentage values. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
packages/components/src/components/progress/shadow.tsx:119
- [nitpick] Consider extracting the width calculation expression into a well-named variable with an accompanying comment to clarify the intent behind adding 1 and using the string length for measurement.
<div class="kol-progress__bar-value" style={{ width: `${`${(isPercentage ? 100 : this.state._max) + 1}`.length}ch` }}>
Contributor
|
Netlify Draft Deployment |
$ Refs: #7397
deleonio
approved these changes
Mar 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs: #7397
This pull request includes changes to the
KolProgresscomponent and its usage in theProgressBasicsample to improve the display of progress values. The most important changes include modifying the width calculation for the progress bar value and updating the sample values for better demonstration.Changes to
KolProgresscomponent:packages/components/src/components/progress/shadow.tsx: Modified the width calculation of the progress bar value to account for percentage values, ensuring proper display whenisPercentageis true.Updates to
ProgressBasicsample:packages/samples/react/src/components/progress/basic.tsx: Updated the_maxand_valueproperties ofKolProgressinstances in the sample to demonstrate different progress values.Refs #7397
The A11y and PO reviews will only take place after all other DoD steps have been completed by the Developer: