mirror of
https://github.com/supabase/supabase.git
synced 2026-05-10 10:50:18 -04:00
b997b7fb13
- add new [OrgSelector](https://github.com/supabase/supabase/pull/43238/changes#diff-214b339101a9c06864ea2755ac7246eb4c971ce74c5d3169b1385a28ee1d4227) and [ProjectBranchSelector](https://github.com/supabase/supabase/pull/43238/changes#diff-82d25c128c306b61bea7481026f58f670a229874f23ca3a1a1d78ddeabde21e0) components to the mobile navigation, replacing the previous which took up a lot of horizontal space - org/project/branch dropdowns now open up in the bottom MobileSheetNav for a better mobile ux - desktop nav remains unchanged
21 lines
552 B
TypeScript
21 lines
552 B
TypeScript
import { useCallback } from 'react'
|
|
|
|
/**
|
|
* Returns a close handler for embedded vs standalone dropdown/sheet usage.
|
|
* When embedded, uses the provided onClose callback (or no-op if not provided).
|
|
* When standalone, returns a function that calls setOpen(false).
|
|
*/
|
|
export function useEmbeddedCloseHandler(
|
|
embedded: boolean,
|
|
onClose?: () => void,
|
|
setOpen?: (open: boolean) => void
|
|
): () => void {
|
|
return useCallback(() => {
|
|
if (embedded) {
|
|
onClose?.()
|
|
} else {
|
|
setOpen?.(false)
|
|
}
|
|
}, [embedded, onClose, setOpen])
|
|
}
|