Fixed refresh button to use loading
This commit is contained in:
parent
adf1235257
commit
abf6955ec9
1 changed files with 3 additions and 6 deletions
|
|
@ -31,11 +31,7 @@ function RefreshButton({
|
||||||
|
|
||||||
// icon class name should take into account the disabled state and the loading state
|
// icon class name should take into account the disabled state and the loading state
|
||||||
const disabledIconTextClass = disabled ? "text-muted-foreground" : "";
|
const disabledIconTextClass = disabled ? "text-muted-foreground" : "";
|
||||||
const iconClassName = cn(
|
const iconClassName = cn("h-4 w-4 animate-wiggle", disabledIconTextClass);
|
||||||
"h-4 w-4",
|
|
||||||
isLoading ? "animate-spin" : "animate-wiggle",
|
|
||||||
disabledIconTextClass
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -44,10 +40,11 @@ function RefreshButton({
|
||||||
className={classNames}
|
className={classNames}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
id={id}
|
id={id}
|
||||||
|
loading={isLoading}
|
||||||
>
|
>
|
||||||
{button_text && <span className="mr-1">{button_text}</span>}
|
{button_text && <span className="mr-1">{button_text}</span>}
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name={isLoading ? "Loader2" : "RefreshCcw"}
|
name={"RefreshCcw"}
|
||||||
className={iconClassName}
|
className={iconClassName}
|
||||||
id={id + "-icon"}
|
id={id + "-icon"}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue