diff --git a/app/(prowler)/providers/page.tsx b/app/(prowler)/providers/page.tsx index 687eca0ed6..d3cd8c1611 100644 --- a/app/(prowler)/providers/page.tsx +++ b/app/(prowler)/providers/page.tsx @@ -1,7 +1,7 @@ import { Spacer } from "@nextui-org/react"; import React from "react"; -import { CustomTable, Header } from "@/components"; +import { CustomTable, Header, ModalWrap } from "@/components"; const visibleColumns: string[] = [ "account", @@ -15,6 +15,11 @@ const visibleColumns: string[] = [ ]; export default function Providers() { + const onSave = async () => { + "use server"; + // event we want to pass down, ex. console.log("### hello"); + }; + return ( <>
@@ -25,6 +30,17 @@ export default function Providers() { selectionMode={"none"} /> + +

Modal body content

+ + } + actionButtonLabel="Save" + onAction={onSave} + openButtonLabel="Open Modal" + /> ); } diff --git a/components/Navbar.tsx b/components/Navbar.tsx deleted file mode 100644 index 2471830968..0000000000 --- a/components/Navbar.tsx +++ /dev/null @@ -1,60 +0,0 @@ -"use client"; - -import { - Link, - Navbar as NextUINavbar, - NavbarBrand, - NavbarContent, - NavbarItem, - NavbarMenu, - NavbarMenuItem, - NavbarMenuToggle, -} from "@nextui-org/react"; -import React from "react"; - -export const Navbar = () => { - const [isMenuOpen, setIsMenuOpen] = React.useState(false); - - const menuItems = ["Test Link", "Log Out"]; - - return ( - - - - -

PROWLER

-
-
- - - - - Login - - - - - Cloud Accounts - - - - - About - - - - - - {menuItems.map((item, index) => ( - - - {item} - - - ))} - -
- ); -}; diff --git a/components/index.ts b/components/index.ts index a1ef4db7b1..0d1a39d806 100644 --- a/components/index.ts +++ b/components/index.ts @@ -2,5 +2,6 @@ export * from "./providers/AccountInfo"; export * from "./providers/DateWithTime"; export * from "./providers/ScanStatus"; export * from "./ui/header/Header"; +export * from "./ui/modal"; export * from "./ui/sidebar"; export * from "./ui/table/CustomTable"; diff --git a/components/ui/modal/Modal.tsx b/components/ui/modal/Modal.tsx new file mode 100644 index 0000000000..ca7754a96e --- /dev/null +++ b/components/ui/modal/Modal.tsx @@ -0,0 +1,65 @@ +import { + Button, + Modal as ModalContainer, + ModalBody, + ModalContent, + ModalFooter, + ModalHeader, +} from "@nextui-org/react"; +import React from "react"; + +interface ModalProps { + modalTitle: string; + modalBody: React.ReactNode; + closeButtonLabel?: string; + actionButtonLabel?: string; + onAction: () => void; + isOpen: boolean; + onOpenChange: (isOpen: boolean) => void; + isDismissable?: boolean; + isKeyboardDismissDisabled?: boolean; + hideCloseButton?: boolean; +} + +export const Modal: React.FC = ({ + modalTitle, + modalBody, + closeButtonLabel, + actionButtonLabel, + onAction, + isOpen, + onOpenChange, + isDismissable, +}) => { + return ( + <> + + + {(onClose) => ( + <> + + {modalTitle} + + {modalBody} + + + + + + )} + + + + ); +}; diff --git a/components/ui/modal/ModalWrap.tsx b/components/ui/modal/ModalWrap.tsx new file mode 100644 index 0000000000..42318210bf --- /dev/null +++ b/components/ui/modal/ModalWrap.tsx @@ -0,0 +1,48 @@ +"use client"; + +import { Button, useDisclosure } from "@nextui-org/react"; +import React from "react"; + +import { Modal } from "@/components"; + +interface ModalWrapProps { + modalTitle: string; + modalBody: React.ReactNode; + closeButtonLabel?: string; + actionButtonLabel?: string; + onAction: () => void; + openButtonLabel?: string; + isDismissable?: boolean; +} + +export const ModalWrap: React.FC = ({ + modalTitle, + modalBody, + closeButtonLabel = "Close", + actionButtonLabel = "Save", + onAction, + openButtonLabel = "Open", + isDismissable = true, +}) => { + const { isOpen, onOpen, onClose, onOpenChange } = useDisclosure(); + const closeOnAction = () => { + onAction?.(); + onClose(); + }; + + return ( + <> + + + + ); +}; diff --git a/components/ui/modal/index.ts b/components/ui/modal/index.ts new file mode 100644 index 0000000000..c33df2971c --- /dev/null +++ b/components/ui/modal/index.ts @@ -0,0 +1,2 @@ +export * from "./Modal"; +export * from "./ModalWrap"; diff --git a/package.json b/package.json index a4aa735b6d..c3aaef6df5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "dependencies": { - "@heroicons/react": "^2.1.4", "@nextui-org/react": "^2.4.2", "@nextui-org/system": "2.2.1", "@nextui-org/theme": "2.2.5",