refactor: remove two components and create a new one, reducing code and improving efficiency

This commit is contained in:
Pablo Lara committed 2024-09-06 10:20:59 +02:00
1 parent a9ff875a3a
commit bc7c3bd74b
7 files changed
+35 -44

No files matched your search

@@ -0,0 +1,30 @@
"use client";
import { Button, CircularProgress } from "@nextui-org/react";
import clsx from "clsx";
import { useFormStatus } from "react-dom";
interface CustomButtonClientActionProps {
buttonLabel: string;
danger?: boolean;
}
export const CustomButtonClientAction = ({
buttonLabel,
danger = false,
}: CustomButtonClientActionProps) => {
const { pending } = useFormStatus();
return (
<Button
className={clsx("bg-transparent border-none p-0 m-0 h-fit min-w-min", {
"text-danger": danger,
})}
spinner={<CircularProgress aria-label="Loading..." size="sm" />}
type="submit"
area-disabled={pending}
>
{buttonLabel}
</Button>
);
};
+1
View File
@@ -1,2 +1,3 @@
export * from "./CustomBox";
export * from "./CustomButtonClientAction";
export * from "./CustomInput";