mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-01-16 04:54:52 +02:00
disable Button while loading
This commit is contained in:
parent
44a70d0c99
commit
f34c630ce1
@ -9,13 +9,13 @@ const Button = ({ children, type, onClick, isSubmit, className, size, isLoading,
|
||||
|
||||
switch (type) {
|
||||
case 'success':
|
||||
color = `bg-green ${isDisabled ? null : "hover:glow-green hover:bg-green-light" }`;
|
||||
color = `bg-green ${isDisabled || isLoading ? null : "hover:glow-green hover:bg-green-light" }`;
|
||||
break;
|
||||
case 'danger':
|
||||
color = `bg-red ${isDisabled ? null : "hover:glow-red hover:bg-red-light"}`;
|
||||
color = `bg-red ${isDisabled || isLoading ? null : "hover:glow-red hover:bg-red-light"}`;
|
||||
break;
|
||||
default:
|
||||
color = `bg-gray-light ${isDisabled ? null : "hover:glow-orange hover:bg-orange"}`
|
||||
color = `bg-gray-light ${isDisabled || isLoading ? null : "hover:glow-orange hover:bg-orange"}`
|
||||
}
|
||||
|
||||
switch (size) {
|
||||
@ -27,7 +27,7 @@ const Button = ({ children, type, onClick, isSubmit, className, size, isLoading,
|
||||
}
|
||||
|
||||
return (
|
||||
<button onClick={onClick} disabled={isDisabled} className={`${className ? className: null} ${isDisabled ? "bg-opacity-50 cursor-not-allowed" : null} ${padding} ${color} inline-block accentuated text-black font-bold`}
|
||||
<button onClick={onClick} disabled={isDisabled || isLoading} className={`${className ? className: null} ${isDisabled || isLoading ? "bg-opacity-50 cursor-not-allowed" : null} ${padding} ${color} inline-block accentuated text-black font-bold`}
|
||||
type={isSubmit ? 'submit' : 'button'}>
|
||||
{children} { isLoading && <FontAwesomeIcon icon={faSpinner} spin={true}/>}
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user