Skip to content

Commit

Permalink
refactor(progress): prefer percent in value text
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Aug 6, 2024
1 parent fa187da commit a54a014
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 11 deletions.
4 changes: 4 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ description: All notable changes will be documented in this file.

## [Unreleased]

### Changed

- **Progress**: Update `Progress.ValueText` to render percentage as string.

## [3.6.2] - 2024-07-28

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const ProgressValueText = forwardRef<HTMLSpanElement, ProgressValueTextPr

return (
<ark.span {...mergedProps} ref={ref}>
{children || progress.valueAsString}
{children || progress.percentAsString}
</ark.span>
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ describe('Progress', () => {
it('should render', async () => {
render(<ComponentUnderTest value={7} />)

screen.getByText('7 percent')
screen.getByText('7%')
})

it('should handle custom max range', async () => {
render(<ComponentUnderTest value={30} max={30} />)

screen.getByText('100 percent')
screen.getByText('100%')
})
})
7 changes: 6 additions & 1 deletion packages/solid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ description: All notable changes will be documented in this file.

## [Unreleased]

### Changed

- **Progress**: Update `Progress.ValueText` to render percentage as string.

## [3.6.2] - 2024-07-28

### Changed
Expand All @@ -15,7 +19,8 @@ description: All notable changes will be documented in this file.
### Fixed

- **DatePicker**:
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and then focusing the input.
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and
then focusing the input.
- Fixed SSR issue when using `getPresetTrigger`.
- **Slider**: Fixed issue where `onValueChangeEnd` was called with an incorrect value.
- Fixed an import issue with `@internationalized/date`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export const ProgressValueText = (props: ProgressValueTextProps) => {
const api = useProgressContext()
const mergedProps = mergeProps(() => api().getValueTextProps(), props)

return <ark.span {...mergedProps}>{props.children || api().valueAsString}</ark.span>
return <ark.span {...mergedProps}>{props.children || api().percentAsString}</ark.span>
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ describe('Progress', () => {
it('should handle default value', async () => {
render(() => <ComponentUnderTest value={7} />)

screen.getByText('7 percent')
screen.getByText('7%')
})

it('should handle custom max range', async () => {
render(() => <ComponentUnderTest value={30} max={30} />)

screen.getByText('100 percent')
screen.getByText('100%')
})
})
7 changes: 6 additions & 1 deletion packages/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ description: All notable changes will be documented in this file.

## [Unreleased]

### Changed

- **Progress**: Update `Progress.ValueText` to render percentage as string.

## [3.7.2] - 2024-07-28

### Changed
Expand All @@ -15,7 +19,8 @@ description: All notable changes will be documented in this file.
### Fixed

- **DatePicker**:
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and then focusing the input.
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and
then focusing the input.
- Fixed SSR issue when using `getPresetTrigger`.
- **Slider**: Fixed issue where `onValueChangeEnd` was called with an incorrect value.
- Fixed an import issue with `@internationalized/date`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ const slots = useSlots()

<template>
<ark.span v-bind="progress.getValueTextProps()" :as-child="asChild">
<slot>{{ slots.default?.() || progress.valueAsString }}</slot>
<slot>{{ slots.default?.() || progress.percentAsString }}</slot>
</ark.span>
</template>
4 changes: 2 additions & 2 deletions packages/vue/src/components/progress/tests/progress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Progress', () => {
},
})

screen.getByText('7 percent')
screen.getByText('7%')
})

it('should handle custom max range', async () => {
Expand All @@ -32,6 +32,6 @@ describe('Progress', () => {
},
})

screen.getByText('100 percent')
screen.getByText('100%')
})
})

0 comments on commit a54a014

Please sign in to comment.