mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-02 00:17:49 +01:00
Extract transcoding options to its own hook
This commit is contained in:
parent
d9c42b3183
commit
c8293fcdd8
4 changed files with 114 additions and 94 deletions
|
|
@ -4,12 +4,12 @@ import { useCallback, useMemo, useState } from 'react'
|
|||
export const useDialog = () => {
|
||||
const [anchorEl, setAnchorEl] = useState(null)
|
||||
|
||||
const open = useCallback((event) => {
|
||||
const openDialog = useCallback((event) => {
|
||||
event?.stopPropagation()
|
||||
setAnchorEl(event.currentTarget)
|
||||
}, [])
|
||||
|
||||
const close = useCallback((event) => {
|
||||
const closeDialog = useCallback((event) => {
|
||||
event?.stopPropagation()
|
||||
setAnchorEl(null)
|
||||
}, [])
|
||||
|
|
@ -18,13 +18,13 @@ export const useDialog = () => {
|
|||
return {
|
||||
anchorEl,
|
||||
open: Boolean(anchorEl),
|
||||
onClose: close,
|
||||
onClose: closeDialog,
|
||||
}
|
||||
}, [anchorEl, close])
|
||||
}, [anchorEl, closeDialog])
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
props,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue