Merge branch 'release(DSAAS)' into release(MVP)

This commit is contained in:
Keven Willian Pereira de Souza 2025-09-22 11:29:07 -03:00
commit 33b90afbe1
3 changed files with 42 additions and 27 deletions

View file

@ -1,30 +1,34 @@
'use client';
import { forwardRef } from "react";
import { Button } from "@/components/ui/button";
import { Loader2 } from "lucide-react";
import clsx from "clsx";
import LoadingButtonProps from "./LoadingButtonProps";
interface LoadingButtonProps {
text: string;
loading?: boolean; // recebe loading do form
type?: "button" | "submit" | "reset";
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive";
}
const LoadingButton = forwardRef<HTMLButtonElement, LoadingButtonProps>(
({ text, textLoading, loading = false, className, disabled, ...props }, ref) => {
return (
<Button
ref={ref}
disabled={loading || disabled}
aria-busy={loading}
aria-live="polite"
className={clsx(
"flex items-center justify-center gap-2 w-full my-3 cursor-pointer",
className
)}
{...props}
>
{loading && <Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" />}
<span>
{loading ? textLoading : text}
</span>
</Button>
);
}
);
export default function LoadingButton({
text,
loading = false,
type = "button",
variant = "default",
}: LoadingButtonProps) {
return (
<Button
type={type}
disabled={loading}
variant={variant}
className="flex items-center gap-2 w-full my-3 justify-center"
>
{loading && <Loader2 className="h-4 w-4 animate-spin" />}
{loading ? "Processando..." : text}
</Button>
);
}
LoadingButton.displayName = "LoadingButton";
export default LoadingButton;

View file

@ -0,0 +1,7 @@
import { Button } from "@/components/ui/button";
export default interface LoadingButtonProps extends React.ComponentProps<typeof Button> {
text: string;
textLoading: string;
loading?: boolean;
}

View file

@ -90,7 +90,7 @@ export function LoginForm({ className, ...props }: React.ComponentProps<"div">)
/>
{/* Botão de loading */}
<LoadingButton text="Entrar" type="submit" loading={loading} />
<LoadingButton text="Entrar" textLoading="Aguarde..." type="submit" loading={loading} />
<div className="after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t my-4">
<span className="bg-card text-muted-foreground relative z-10 px-2">
@ -99,8 +99,12 @@ export function LoginForm({ className, ...props }: React.ComponentProps<"div">)
</div>
<div className="grid grid-cols-2 gap-4">
<Button variant="outline" type="button" className="w-full">Chamar no Whatsapp</Button>
<Button variant="outline" type="button" className="w-full">Chamar no Local</Button>
<Button variant="outline" type="button" className="w-full">
Chamar no Whatsapp
</Button>
<Button variant="outline" type="button" className="w-full">
Chamar no Local
</Button>
</div>
</form>