UNPKG

mod-arch-shared

Version:

Shared UI components and utilities for modular architecture micro-frontend projects

13 lines 1.38 kB
import * as React from 'react'; import { useId } from 'react'; import { Modal, ModalBody, ModalHeader, ModalFooter, Button, } from '@patternfly/react-core'; const ContentModal = ({ onClose, contents, title, buttonActions, description, disableFocusTrap, dataTestId = 'content-modal', bodyClassName, variant = 'medium', bodyLabel, titleIconVariant, }) => { const headingId = useId(); const descriptionId = useId(); return (React.createElement(Modal, { "data-testid": dataTestId, isOpen: true, variant: variant, onClose: onClose, disableFocusTrap: disableFocusTrap, "aria-labelledby": headingId, "aria-describedby": description ? descriptionId : undefined }, React.createElement(ModalHeader, { title: title, labelId: headingId, description: description ? React.createElement("div", { id: descriptionId }, description) : undefined, titleIconVariant: titleIconVariant, "data-testid": "generic-modal-header" }), React.createElement(ModalBody, { className: bodyClassName, "aria-label": bodyLabel }, contents), buttonActions && (React.createElement(ModalFooter, null, buttonActions.map((action, index) => (React.createElement(Button, { key: `${action.label}-${index}`, variant: action.variant, onClick: action.onClick, "data-testid": action.dataTestId }, action.label))))))); }; export default ContentModal; //# sourceMappingURL=ContentModal.js.map