import { ReactNode } from 'react'; import styled from '@emotion/styled'; import { DROPDOWN } from 'styles/zIndex'; import ReactPopover from 'react-popover'; import noop from 'utils/noop'; import { white } from 'styles/colors'; const StyledPopover = styled(ReactPopover)` /* !! Need to add this to handle popover flickering issue */ object.resize-sensor { opacity: 0 !important; } z-index: ${DROPDOWN}; filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.22)); & .Popover-tip { fill: ${white}; } & .Popover-body { padding: 0; background: ${white}; } `; export interface Props { // props from popover library body: ReactNode; children: ReactNode; appendTarget?: any; className?: string; isOpen: boolean; offset?: number; place?: 'above' | 'right' | 'below' | 'left'; preferPlace?: 'above' | 'right' | 'below' | 'left'; enterExitTransitionDurationMs?: number; refreshIntervalMs: number | boolean; style?: Record; tipSize: number; onOuterAction: () => void; } const Popover = ({ body, children, appendTarget = document.body, className, isOpen = false, offset = 0, place, preferPlace, enterExitTransitionDurationMs = 500, refreshIntervalMs = 200, onOuterAction = noop, tipSize = 7, style, }: Props) => { const libraryProps = { body, appendTarget, className, enterExitTransitionDurationMs, isOpen, place, preferPlace, refreshIntervalMs, onOuterAction, tipSize, style, offset, }; return {children}; }; export default Popover;