chore: Optimize operations in Q&A mode (#9274)

Co-authored-by: billsyli <billsyli@tencent.com>
This commit is contained in:
我有一把妖刀
2024-10-14 13:32:13 +08:00
committed by GitHub
parent 7a405b86c9
commit 5ee7e03c1b
3 changed files with 33 additions and 17 deletions

View File

@@ -17,6 +17,7 @@ type IPopover = {
btnElement?: string | React.ReactNode
btnClassName?: string | ((open: boolean) => string)
manualClose?: boolean
disabled?: boolean
}
const timeoutDuration = 100
@@ -30,6 +31,7 @@ export default function CustomPopover({
className,
btnClassName,
manualClose,
disabled = false,
}: IPopover) {
const buttonRef = useRef<HTMLButtonElement>(null)
const timeOutRef = useRef<NodeJS.Timeout | null>(null)
@@ -60,6 +62,7 @@ export default function CustomPopover({
>
<Popover.Button
ref={buttonRef}
disabled={disabled}
className={`group ${s.popupBtn} ${open ? '' : 'bg-gray-100'} ${!btnClassName
? ''
: typeof btnClassName === 'string'