mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 13:01:56 +00:00
chore: remove the old modal component
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
export * from "./alert/Alert";
|
||||
export * from "./dialog/Dialog";
|
||||
export * from "./header/Header";
|
||||
export * from "./modal";
|
||||
export * from "./sidebar";
|
||||
export * from "./table/StatusBadge";
|
||||
export * from "./table/Table";
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
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<ModalProps> = ({
|
||||
modalTitle,
|
||||
modalBody,
|
||||
closeButtonLabel,
|
||||
actionButtonLabel,
|
||||
onAction,
|
||||
isOpen,
|
||||
onOpenChange,
|
||||
isDismissable,
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<ModalContainer
|
||||
isOpen={isOpen}
|
||||
onOpenChange={onOpenChange}
|
||||
backdrop="blur"
|
||||
isDismissable={isDismissable}
|
||||
isKeyboardDismissDisabled={!isDismissable}
|
||||
hideCloseButton={!isDismissable}
|
||||
>
|
||||
<ModalContent>
|
||||
{(onClose) => (
|
||||
<>
|
||||
<ModalHeader className="flex flex-col gap-1">
|
||||
{modalTitle}
|
||||
</ModalHeader>
|
||||
<ModalBody>{modalBody}</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="danger" variant="light" onPress={onClose}>
|
||||
{closeButtonLabel}
|
||||
</Button>
|
||||
<Button color="primary" onPress={onAction}>
|
||||
{actionButtonLabel}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</>
|
||||
)}
|
||||
</ModalContent>
|
||||
</ModalContainer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -1,48 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { Button, useDisclosure } from "@nextui-org/react";
|
||||
import React from "react";
|
||||
|
||||
import { Modal } from "@/components/ui";
|
||||
|
||||
interface ModalWrapProps {
|
||||
modalTitle: string;
|
||||
modalBody: React.ReactNode;
|
||||
closeButtonLabel?: string;
|
||||
actionButtonLabel?: string;
|
||||
onAction: () => void;
|
||||
openButtonLabel?: string;
|
||||
isDismissable?: boolean;
|
||||
}
|
||||
|
||||
export const ModalWrap: React.FC<ModalWrapProps> = ({
|
||||
modalTitle,
|
||||
modalBody,
|
||||
closeButtonLabel = "Close",
|
||||
actionButtonLabel = "Save",
|
||||
onAction,
|
||||
openButtonLabel = "Open",
|
||||
isDismissable = true,
|
||||
}) => {
|
||||
const { isOpen, onOpen, onClose, onOpenChange } = useDisclosure();
|
||||
const closeOnAction = () => {
|
||||
onAction?.();
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button onPress={onOpen}>{openButtonLabel}</Button>
|
||||
<Modal
|
||||
modalTitle={modalTitle}
|
||||
modalBody={modalBody}
|
||||
closeButtonLabel={closeButtonLabel}
|
||||
actionButtonLabel={actionButtonLabel}
|
||||
onAction={closeOnAction}
|
||||
isDismissable={isDismissable}
|
||||
isOpen={isOpen}
|
||||
onOpenChange={onOpenChange}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from "./Modal";
|
||||
export * from "./ModalWrap";
|
||||
Reference in New Issue
Block a user