import { memo, ReactNode, useCallback, useState } from 'react' import { Button, ButtonProps, Form, FormProps, Popover, PopoverProps } from 'antd' export type PopromptProps = PopoverProps & { children?: ReactNode footer?: ReactNode text?: string onDone?: (values: any) => void formProps?: FormProps buttonProps?: ButtonProps } export const Poprompt = memo(({ formProps, buttonProps, footer, children, onDone, text, ...other }) => { const [visible, setVisible] = useState(false) const onFormFinish = useCallback((values: any) => { setVisible(false) onDone?.(values) }, [onDone]) return ( {children} {footer ?? (
)}
)} trigger={'click'} {...other} open={visible} onOpenChange={(visible) => setVisible(visible)} >
) }) export default Poprompt