diff --git a/components/providers/ButtonCheckConnectionProvider.tsx b/components/providers/ButtonCheckConnectionProvider.tsx deleted file mode 100644 index 5b921a7dfb..0000000000 --- a/components/providers/ButtonCheckConnectionProvider.tsx +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import { Button } from "@nextui-org/react"; -import React from "react"; -import { useFormStatus } from "react-dom"; - -export const ButtonCheckConnectionProvider = () => { - const { pending } = useFormStatus(); - return ( - - ); -}; diff --git a/components/providers/ButtonDeleteProvider.tsx b/components/providers/ButtonDeleteProvider.tsx deleted file mode 100644 index ceabce0c6d..0000000000 --- a/components/providers/ButtonDeleteProvider.tsx +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import { Button } from "@nextui-org/react"; -import React from "react"; -import { useFormStatus } from "react-dom"; - -export const ButtonDeleteProvider = () => { - const { pending } = useFormStatus(); - return ( - - ); -}; diff --git a/components/providers/CheckConnectionProvider.tsx b/components/providers/CheckConnectionProvider.tsx index ed3f5db69a..a7d4ec8360 100644 --- a/components/providers/CheckConnectionProvider.tsx +++ b/components/providers/CheckConnectionProvider.tsx @@ -4,8 +4,8 @@ import { useRef } from "react"; import { checkConnectionProvider } from "@/actions"; +import { CustomButtonClientAction } from "../ui/custom"; import { useToast } from "../ui/toast"; -import { ButtonCheckConnectionProvider } from "./ButtonCheckConnectionProvider"; export const CheckConnectionProvider = ({ id }: { id: string }) => { const ref = useRef(null); @@ -35,7 +35,7 @@ export const CheckConnectionProvider = ({ id }: { id: string }) => { return (
- + ); }; diff --git a/components/providers/DeleteProvider.tsx b/components/providers/DeleteProvider.tsx index dba2cf22e8..c5090ef274 100644 --- a/components/providers/DeleteProvider.tsx +++ b/components/providers/DeleteProvider.tsx @@ -4,8 +4,8 @@ import { useRef } from "react"; import { deleteProvider } from "@/actions"; +import { CustomButtonClientAction } from "../ui/custom"; import { useToast } from "../ui/toast"; -import { ButtonDeleteProvider } from "./ButtonDeleteProvider"; export const DeleteProvider = ({ id }: { id: string }) => { const ref = useRef(null); @@ -35,7 +35,7 @@ export const DeleteProvider = ({ id }: { id: string }) => { return (
- + ); }; diff --git a/components/providers/index.ts b/components/providers/index.ts index 0b4074236c..58c8dae90f 100644 --- a/components/providers/index.ts +++ b/components/providers/index.ts @@ -1,8 +1,6 @@ export * from "./AddProvider"; export * from "./AddProviderModal"; export * from "./ButtonAddProvider"; -export * from "./ButtonCheckConnectionProvider"; -export * from "./ButtonDeleteProvider"; export * from "./CheckConnectionProvider"; export * from "./CustomRadioProvider"; export * from "./DateWithTime"; diff --git a/components/ui/custom/CustomButtonClientAction.tsx b/components/ui/custom/CustomButtonClientAction.tsx new file mode 100644 index 0000000000..ef31fbb5ec --- /dev/null +++ b/components/ui/custom/CustomButtonClientAction.tsx @@ -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 ( + + ); +}; diff --git a/components/ui/custom/index.ts b/components/ui/custom/index.ts index 126110ade6..dbc111a3cc 100644 --- a/components/ui/custom/index.ts +++ b/components/ui/custom/index.ts @@ -1,2 +1,3 @@ export * from "./CustomBox"; +export * from "./CustomButtonClientAction"; export * from "./CustomInput";