client: improve clicking jump to file button
This commit is contained in:
parent
06fad98ee1
commit
f927fae9ed
1 changed files with 11 additions and 4 deletions
|
@ -19,6 +19,9 @@ const FileDropdown = ({
|
||||||
}) => {
|
}) => {
|
||||||
const [expanded, setExpanded] = useState(false)
|
const [expanded, setExpanded] = useState(false)
|
||||||
const [items, setItems] = useState<Item[]>([])
|
const [items, setItems] = useState<Item[]>([])
|
||||||
|
const changeHandler = (next: boolean) => {
|
||||||
|
setExpanded(next)
|
||||||
|
}
|
||||||
|
|
||||||
const onOpen = useCallback(() => {
|
const onOpen = useCallback(() => {
|
||||||
setExpanded(true)
|
setExpanded(true)
|
||||||
|
@ -62,11 +65,15 @@ const FileDropdown = ({
|
||||||
|
|
||||||
// a list of files with an icon and a title
|
// a list of files with an icon and a title
|
||||||
return (
|
return (
|
||||||
<Button auto onClick={onOpen} className={styles.button} iconRight={<ChevronDown />}>
|
<>
|
||||||
<Popover content={content} visible={expanded} hideArrow={true}>
|
<Button auto onClick={onOpen} className={styles.button} iconRight={<ChevronDown />}>
|
||||||
Jump to {files.length} {files.length === 1 ? 'file' : 'files'}
|
Jump to {files.length} {files.length === 1 ? 'file' : 'files'}
|
||||||
</Popover>
|
</Button>
|
||||||
</Button >
|
<Popover
|
||||||
|
onVisibleChange={changeHandler}
|
||||||
|
content={content} visible={expanded} hideArrow={true} onClick={onClose} />
|
||||||
|
</>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue