mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
39 lines
781 B
TypeScript
39 lines
781 B
TypeScript
import {
|
|
BoxProps,
|
|
Popover,
|
|
PopoverArrow,
|
|
PopoverContent,
|
|
PopoverProps,
|
|
PopoverTrigger,
|
|
} from '@chakra-ui/react';
|
|
import { memo, ReactNode } from 'react';
|
|
|
|
export type IAIPopoverProps = PopoverProps & {
|
|
triggerComponent: ReactNode;
|
|
triggerContainerProps?: BoxProps;
|
|
children: ReactNode;
|
|
hasArrow?: boolean;
|
|
};
|
|
|
|
const IAIPopover = (props: IAIPopoverProps) => {
|
|
const {
|
|
triggerComponent,
|
|
children,
|
|
hasArrow = true,
|
|
isLazy = true,
|
|
...rest
|
|
} = props;
|
|
|
|
return (
|
|
<Popover isLazy={isLazy} {...rest}>
|
|
<PopoverTrigger>{triggerComponent}</PopoverTrigger>
|
|
<PopoverContent shadow="dark-lg">
|
|
{hasArrow && <PopoverArrow />}
|
|
{children}
|
|
</PopoverContent>
|
|
</Popover>
|
|
);
|
|
};
|
|
|
|
export default memo(IAIPopover);
|