Fixed loading on file component and unstyled buttons not having nocopy and nopan classes

This commit is contained in:
Lucas Oliveira 2024-06-17 23:11:03 -03:00
commit 6f34e039eb
3 changed files with 16 additions and 15 deletions

View file

@ -8,6 +8,7 @@ import useAlertStore from "../../stores/alertStore";
import useFlowsManagerStore from "../../stores/flowsManagerStore"; import useFlowsManagerStore from "../../stores/flowsManagerStore";
import { FileComponentType } from "../../types/components"; import { FileComponentType } from "../../types/components";
import IconComponent from "../genericIconComponent"; import IconComponent from "../genericIconComponent";
import { Button } from "../ui/button";
export default function InputFileComponent({ export default function InputFileComponent({
value, value,
@ -111,20 +112,20 @@ export default function InputFileComponent({
> >
{myValue !== "" ? myValue : "No file"} {myValue !== "" ? myValue : "No file"}
</span> </span>
<button onClick={handleButtonClick}> {!editNode && (
{!editNode && !loading && ( <Button
unstyled
className="ml-3 inline-flex items-center justify-center"
onClick={handleButtonClick}
loading={loading}
disabled={disabled}
>
<IconComponent <IconComponent
name="FileSearch2" name="FileSearch2"
className={ className={"icons-parameters-comp"}
"icons-parameters-comp" +
(disabled ? " text-ring" : " hover:text-accent-foreground")
}
/> />
)} </Button>
{!editNode && loading && ( )}
<span className="loading loading-spinner loading-sm pointer-events-none h-8 pl-3"></span>
)}
</button>
</div> </div>
</div> </div>
); );

View file

@ -76,7 +76,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
<> <>
<Comp <Comp
className={ className={
!unstyled ? buttonVariants({ variant, size, className }) : className !unstyled ? buttonVariants({ variant, size, className }) : cn(className, "nocopy nowheel nopan nodelete nodrag noundo")
} }
disabled={loading || disabled} disabled={loading || disabled}
{...(asChild ? {} : { type: type || "button" })} {...(asChild ? {} : { type: type || "button" })}
@ -86,10 +86,10 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
{loading ? ( {loading ? (
<span className="relative"> <span className="relative">
<span className="invisible">{newChildren}</span> <span className="invisible">{newChildren}</span>
<span className="absolute inset-0 flex items-center justify-center"> <span className="absolute inset-0">
<ForwardedIconComponent <ForwardedIconComponent
name={"Loader2"} name={"Loader2"}
className={"animate-spin"} className={"animate-spin m-auto h-full"}
/> />
</span> </span>
</span> </span>

View file

@ -931,7 +931,7 @@
} }
.icons-parameters-comp { .icons-parameters-comp {
@apply ml-3 h-6 w-6; @apply h-6 w-6;
} }
.form-modal-lock-true { .form-modal-lock-true {