All files / packages/components/src modal.web.tsx

100% Statements 2/2
100% Branches 2/2
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50                                                260x                   7579x                              
import type React from "react";
 
import {
	ModalBody,
	ModalContent,
	ModalHeader,
	Modal as ModalRaw,
} from "@heroui/modal";
 
import type { ViewReactNode } from "~components/view";
 
export type Props = {
	isOpen: boolean;
	onOpenChange: (nextOpen: boolean) => void;
	label?: string;
	testID?: string;
	header?: ViewReactNode;
	children: ViewReactNode;
	className?: string;
	bodyClassName?: string;
	headerClassName?: string;
	closeButton?: boolean;
};
 
export const Modal: React.FC<Props> = ({
	label,
	testID,
	header,
	children,
	className,
	bodyClassName,
	headerClassName,
	...props
}) => (
	<ModalRaw
		aria-label={label}
		scrollBehavior="inside"
		classNames={{ base: className }}
		data-testid={testID}
		{...props}
	>
		<ModalContent>
			{header ? (
				<ModalHeader className={headerClassName}>{header}</ModalHeader>
			) : null}
			<ModalBody className={bodyClassName}>{children}</ModalBody>
		</ModalContent>
	</ModalRaw>
);