diff --git a/components/providers/forms/DeleteForm.tsx b/components/providers/forms/DeleteForm.tsx
index 2a9d79902c..639bee8c93 100644
--- a/components/providers/forms/DeleteForm.tsx
+++ b/components/providers/forms/DeleteForm.tsx
@@ -1,13 +1,13 @@
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
-import { Button, CircularProgress } from "@nextui-org/react";
import React, { Dispatch, SetStateAction } from "react";
import { useForm } from "react-hook-form";
import * as z from "zod";
import { deleteProvider } from "@/actions";
import { useToast } from "@/components/ui";
+import { CustomButton } from "@/components/ui/custom";
import { Form } from "@/components/ui/form";
const formSchema = z.object({
@@ -46,6 +46,7 @@ export const DeleteForm = ({
description: "The provider was removed successfully.",
});
}
+ setIsOpen(false); // Close the modal on success
}
return (
@@ -53,31 +54,28 @@ export const DeleteForm = ({
diff --git a/components/providers/forms/EditForm.tsx b/components/providers/forms/EditForm.tsx
index 8479aeeabb..f61ef8d7c1 100644
--- a/components/providers/forms/EditForm.tsx
+++ b/components/providers/forms/EditForm.tsx
@@ -1,14 +1,13 @@
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
-import { Button, CircularProgress } from "@nextui-org/react";
import React, { Dispatch, SetStateAction } from "react";
import { useForm } from "react-hook-form";
import * as z from "zod";
import { updateProvider } from "@/actions";
import { useToast } from "@/components/ui";
-import { CustomInput } from "@/components/ui/custom";
+import { CustomButton, CustomInput } from "@/components/ui/custom";
import { Form } from "@/components/ui/form";
import { editProviderFormSchema } from "@/types";
@@ -32,6 +31,7 @@ export const EditForm = ({
});
const { toast } = useToast();
+
const isLoading = form.formState.isSubmitting;
const onSubmitClient = async (values: z.infer) => {
@@ -86,29 +86,28 @@ export const EditForm = ({
-
-
-
+ Cancel
+
+
+
+ {isLoading ? <>Loading> : Save}
+
diff --git a/components/ui/custom/CustomButton.tsx b/components/ui/custom/CustomButton.tsx
index 1c322aaac3..c361561846 100644
--- a/components/ui/custom/CustomButton.tsx
+++ b/components/ui/custom/CustomButton.tsx
@@ -1,8 +1,8 @@
-import { Button } from "@nextui-org/react";
+import { Button, CircularProgress } from "@nextui-org/react";
import clsx from "clsx";
export const buttonClasses = {
- base: "w-full md:w-fit px-4 inline-flex items-center justify-center relative z-0 text-center whitespace-nowrap",
+ base: "px-4 inline-flex items-center justify-center relative z-0 text-center whitespace-nowrap",
primary: "bg-default-100 hover:bg-default-200 text-default-800",
secondary: "bg-prowler-grey-light dark:bg-prowler-grey-medium text-white",
action: "text-white bg-prowler-blue-smoky dark:bg-prowler-grey-medium",
@@ -14,6 +14,8 @@ export const buttonClasses = {
};
interface ButtonProps {
+ type: "button" | "submit" | "reset";
+ className?: string;
variant?:
| "solid"
| "faded"
@@ -31,7 +33,7 @@ interface ButtonProps {
| "warning"
| "danger"
| "transparent";
- onClick?: (event: React.MouseEvent) => void;
+ onPress?: (event: React.MouseEvent) => void;
children: React.ReactNode;
startContent?: React.ReactNode;
endContent?: React.ReactNode;
@@ -44,9 +46,11 @@ interface ButtonProps {
}
export const CustomButton = ({
+ type = "button",
+ className,
variant = "solid",
color = "primary",
- onClick,
+ onPress,
children,
startContent,
endContent,
@@ -58,23 +62,28 @@ export const CustomButton = ({
...props
}: ButtonProps) => (
}
isLoading={isLoading}
isIconOnly={isIconOnly}
{...props}
diff --git a/tailwind.config.js b/tailwind.config.js
index e9dd78c401..6d2ff06563 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -81,6 +81,7 @@ module.exports = {
low: "#fcd34d",
},
},
+ danger: "#E11D48",
},
fontFamily: {
sans: ["var(--font-sans)"],