Skip to content

Commit

Permalink
fix(StepProgress): ensure that undefined value is treated correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sjschlapbach committed Feb 8, 2024
1 parent 167c2ef commit 7bf2a94
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/StepProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ export function StepProgress({
!items && 'bg-primary-60 text-white'
)}
onClick={() =>
onItemClick((value || 0) - 1, items && items[(value || 0) - 1])
onItemClick(
(typeof value === 'undefined' ? 1 : value) - 1,
items && items[(typeof value === 'undefined' ? 1 : value) - 1]
)
}
>
<FontAwesomeIcon icon={faChevronLeft} />
Expand Down Expand Up @@ -174,7 +177,10 @@ export function StepProgress({
'rounded-r px-3 py-1 hover:bg-primary-20 hover:text-primary'
)}
onClick={() =>
onItemClick((value || 0) + 1, items && items[(value || 0) + 1])
onItemClick(
(typeof value === 'undefined' ? -1 : value) + 1,
items && items[(typeof value === 'undefined' ? -1 : value) + 1]
)
}
>
<FontAwesomeIcon icon={faChevronRight} />
Expand Down

0 comments on commit 7bf2a94

Please sign in to comment.