Refactor RefreshButton component to accept className and id props
This commit is contained in:
parent
9244db0c24
commit
4487a839e6
1 changed files with 8 additions and 3 deletions
|
|
@ -8,11 +8,15 @@ function RefreshButton({
|
||||||
name,
|
name,
|
||||||
data,
|
data,
|
||||||
handleUpdateValues,
|
handleUpdateValues,
|
||||||
|
className,
|
||||||
|
id,
|
||||||
}: {
|
}: {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
name: string;
|
name: string;
|
||||||
data: NodeDataType;
|
data: NodeDataType;
|
||||||
|
className?: string;
|
||||||
handleUpdateValues: (name: string, data: NodeDataType) => void;
|
handleUpdateValues: (name: string, data: NodeDataType) => void;
|
||||||
|
id: string;
|
||||||
}) {
|
}) {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
|
@ -37,8 +41,8 @@ function RefreshButton({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const className = cn(
|
const classNames = cn(
|
||||||
"extra-side-bar-buttons ml-2 mt-1 w-1/6",
|
className,
|
||||||
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -51,10 +55,11 @@ function RefreshButton({
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button className={className} onClick={handleClick}>
|
<button className={classNames} onClick={handleClick} id={id}>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name={isLoading ? "Loader2" : "RefreshCcw"}
|
name={isLoading ? "Loader2" : "RefreshCcw"}
|
||||||
className={iconClassName}
|
className={iconClassName}
|
||||||
|
id={id + "-icon"}
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue