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
commit 5ee7e03c1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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'