UNPKG

@openshift-console/dynamic-plugin-sdk

Version:

Provides core APIs, types and utilities used by dynamic plugins at runtime.

25 lines (24 loc) 1.58 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { Button, Popover, PopoverPosition } from '@patternfly/react-core'; import './PopoverStatus.scss'; /** * Component for creating a status popover item * @param {ReactNode} statusBody - content displayed within the popover. * @param {function} [onHide] - (optional) function invoked when popover begins to transition out * @param {function} [onShow] - (optional) function invoked when popover begins to appear * @param {string} [title] - (optional) title for the popover * @param {boolean} [hideHeader] - (optional) when true, header text is hidden * @param {boolean} [isVisible] - (optional) when true, the popover is displayed * @param {function} [shouldClose] - (optional) callback function invoked when the popover is closed only if isVisible is also controlled * @param {ReactNode} [children] - (optional) children for the component * @example * ```tsx * <PopoverStatus title={title} statusBody={statusBody}> * {children} * </PopoverStatus> * ``` */ const PopoverStatus = ({ hideHeader, children, isVisible = null, shouldClose = null, shouldOpen = null, statusBody, title, onHide, onShow, }) => { return (_jsx(Popover, { position: PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible, shouldClose: shouldClose, shouldOpen: shouldOpen, children: _jsx(Button, { variant: "link", isInline: true, className: "co-popover-status-button", children: statusBody }) })); }; export default PopoverStatus;