Skip to content

Commit

Permalink
fix handling NaN and undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby committed Nov 21, 2024
1 parent edd4992 commit e73e169
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions react/src/components/BAIProgressWithLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const BAIProgressWithLabel: React.FC<BAIProgressWithLabelProps> = ({
<Flex
style={{
height: '100%',
width: `${percent && percent > 100 ? 100 : percent}%`,
width: `${!percent || _.isNaN(percent) ? 0 : _.min([percent, 100])}%`,
position: 'absolute',
left: 0,
top: 0,
Expand All @@ -63,7 +63,10 @@ const BAIProgressWithLabel: React.FC<BAIProgressWithLabelProps> = ({
<Typography.Text
style={{
fontSize,
color: _.isUndefined(percent) ? token.colorTextDisabled : undefined,
color:
_.isNaN(percent) || _.isUndefined(percent)
? token.colorTextDisabled
: undefined,
...labelStyle,
}}
>
Expand Down

0 comments on commit e73e169

Please sign in to comment.