Skip to content

fix: value length at progress bar when unit is percentage#7439

Merged
deleonio merged 3 commits intorelease/2from
feature/2/7397-fix-value-length
Mar 7, 2025
Merged

fix: value length at progress bar when unit is percentage#7439
deleonio merged 3 commits intorelease/2from
feature/2/7397-fix-value-length

Conversation

@laske185
Copy link
Copy Markdown
Contributor

@laske185 laske185 commented Mar 5, 2025

This pull request includes changes to the KolProgress component and its usage in the ProgressBasic sample. The key changes involve modifying the width calculation for the progress bar value and updating the example values in the sample component.

Changes to KolProgress component:

  • Updated the width calculation for the progress bar value to handle percentage values correctly. (packages/components/src/components/progress/shadow.tsx)

Updates to ProgressBasic sample:

  • Changed the _max and _value properties for the KolProgress components to smaller numbers in the percentages example. (packages/samples/react/src/components/progress/basic.tsx)
  • Updated the _value property for the KolProgress component with a custom unit to a lower value. (packages/samples/react/src/components/progress/basic.tsx)Refs: Inkorrekte Prozentanzeige beim Progress #7397

The A11y and PO reviews will only take place after all other DoD steps have been completed by the Developer:

  • Meaningful pull request title for the release notes
  • Pull request is linked to an issue and all changes relate to the issue
  • Tests to protect this code implemented (if applicable)
  • Manual test performed successfully (if applicable)
  • Documentation or migration has been updated (if applicable)

@laske185 laske185 requested a review from Copilot March 5, 2025 08:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This pull request fixes the progress bar value width calculation when the unit is percentage and updates sample values for the KolProgress component to reflect the corrected behavior.

  • Fix width calculation in KolProgress to handle percentage cases using a conditional value.
  • Update ProgressBasic sample values for both percentage and custom unit examples.

Reviewed Changes

File Description
packages/components/src/components/progress/shadow.tsx Adjusts width calculation by computing the character length of (max + 1) depending on whether the unit is percentage.
packages/samples/react/src/components/progress/basic.tsx Updates example properties (_max and _value) for percentage and custom unit variants.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

packages/components/src/components/progress/shadow.tsx:99

  • [nitpick] Consider extracting the magic value '100' and the '+ 1' adjustment into named constants or a helper function. This will improve clarity around the intention behind calculating the width dynamically based on the unit.
<div class="value" style={{ width: `${`${(isPercentage ? 100 : this.state._max) + 1}`.length}ch` }}>

packages/samples/react/src/components/progress/basic.tsx:24

  • Double-check that the updated _value of 42 for the cycle variant is intentional, as it represents a significant change from the previous value. Ensure this change aligns with the intended display behavior for the component.
<KolProgress _label="Max 150 kg" _variant="cycle" _max={150} _value={42} _unit="kg"></KolProgress>

@laske185 laske185 linked an issue Mar 5, 2025 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 5, 2025

@laske185 laske185 added the v2 label Mar 5, 2025
@deleonio deleonio merged commit 39d98a9 into release/2 Mar 7, 2025
8 checks passed
@deleonio deleonio deleted the feature/2/7397-fix-value-length branch March 7, 2025 04:41
@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2025
@deleonio deleonio removed the v2 label Jun 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inkorrekte Prozentanzeige beim Progress

3 participants