mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
40 lines
859 B
TypeScript
40 lines
859 B
TypeScript
|
import {
|
||
|
Popover,
|
||
|
PopoverArrow,
|
||
|
PopoverContent,
|
||
|
PopoverTrigger,
|
||
|
Box,
|
||
|
} from '@chakra-ui/react';
|
||
|
import { PopoverProps } from '@chakra-ui/react';
|
||
|
import { ReactNode } from 'react';
|
||
|
|
||
|
type IAIPopoverProps = PopoverProps & {
|
||
|
triggerComponent: ReactNode;
|
||
|
children: ReactNode;
|
||
|
styleClass?: string;
|
||
|
hasArrow?: boolean;
|
||
|
};
|
||
|
|
||
|
const IAIPopover = (props: IAIPopoverProps) => {
|
||
|
const {
|
||
|
triggerComponent,
|
||
|
children,
|
||
|
styleClass,
|
||
|
hasArrow = true,
|
||
|
...rest
|
||
|
} = props;
|
||
|
return (
|
||
|
<Popover {...rest}>
|
||
|
<PopoverTrigger>
|
||
|
<Box>{triggerComponent}</Box>
|
||
|
</PopoverTrigger>
|
||
|
<PopoverContent className={`invokeai__popover-content ${styleClass}`}>
|
||
|
{hasArrow && <PopoverArrow className={'invokeai__popover-arrow'} />}
|
||
|
{children}
|
||
|
</PopoverContent>
|
||
|
</Popover>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default IAIPopover;
|