Skip to content

Commit 1fa7542

Browse files
SrivatsaRUpadhyaMees van Dongenrluders
authored
fix(component/progressbar): fix progressbar showing label when progress == 0 (#698)
* fix: group list styling (#668) * fix: group list styling * fix: borders between list group items --------- Co-authored-by: Mees van Dongen <[email protected]> Co-authored-by: Ricardo Lüders <[email protected]> * fix(progress.tsx): progress bar shows labels even when it is disabled at progress value is 0 The conditional rendring using the '&&' would return 0 on condition being false which would get displayed when progress value is 0. This was fixed using ternary operator instead. And also the label would get hidden at low progress values which is now fixed. fix #696 * style(default.ts): changed progress bar label(inside label) color for light mode * fix(components/progressbar): fix progressbar showing label when progress == 0 --------- Co-authored-by: Mees van Dongen <[email protected]> Co-authored-by: Ricardo Lüders <[email protected]>
1 parent ab6e96a commit 1fa7542

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/lib/components/Progress/Progress.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ export const Progress: FC<ProgressProps> = ({
5454
<>
5555
<div id={id} aria-label={textLabel} aria-valuenow={progress} role="progressbar" {...props}>
5656
{((textLabel && labelText && textLabelPosition === 'outside') ||
57-
(progress && labelProgress && progressLabelPosition === 'outside')) && (
57+
(progress > 0 && labelProgress && progressLabelPosition === 'outside')) && (
5858
<div className={theme.label} data-testid="flowbite-progress-outer-label-container">
5959
{textLabel && labelText && textLabelPosition === 'outside' && (
6060
<span data-testid="flowbite-progress-outer-text-label">{textLabel}</span>
6161
)}
62-
{progress && labelProgress && progressLabelPosition === 'outside' && (
62+
{labelProgress && progressLabelPosition === 'outside' && (
6363
<span data-testid="flowbite-progress-outer-progress-label">{progress}%</span>
6464
)}
6565
</div>
6666
)}
67+
6768
<div className={classNames(theme.base, theme.size[size], className)}>
6869
<div
6970
style={{ width: `${progress}%` }}
@@ -72,7 +73,7 @@ export const Progress: FC<ProgressProps> = ({
7273
{textLabel && labelText && textLabelPosition === 'inside' && (
7374
<span data-testid="flowbite-progress-inner-text-label">{textLabel}</span>
7475
)}
75-
{progress && labelProgress && progressLabelPosition === 'inside' && (
76+
{progress > 0 && labelProgress && progressLabelPosition === 'inside' && (
7677
<span data-testid="flowbite-progress-inner-progress-label">{progress}%</span>
7778
)}
7879
</div>

src/lib/theme/default.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ const theme: FlowbiteTheme = {
637637
progress: {
638638
base: 'w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700',
639639
label: 'mb-1 flex justify-between font-medium dark:text-white',
640-
bar: 'flex items-center justify-center rounded-full text-center font-medium leading-none text-blue-100 space-x-2',
640+
bar: 'rounded-full text-center font-medium leading-none text-blue-300 dark:text-blue-100 space-x-2',
641641
color: {
642642
dark: 'bg-gray-600 dark:bg-gray-300',
643643
blue: 'bg-blue-600',

0 commit comments

Comments
 (0)