Skip to content

Commit

Permalink
Merge 65dea41 into 7d97cd3
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkfiedler authored Feb 20, 2025
2 parents 7d97cd3 + 65dea41 commit 8dbf8cc
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const useListenForChildUpdates = ({
}, [action.current, popoverRef])
}

export const useMenuState = ({ maxHeight }: Props = {}) => {
export function useMenuState({ maxHeight }: Props = {}) {
const anchorRef = React.useRef<HTMLDivElement>(null)
const popoverRef = useRerenderingRef<HTMLDivElement>()
const action = React.useRef<PopoverActions | null>(null)
Expand Down Expand Up @@ -140,6 +140,8 @@ export const useMenuState = ({ maxHeight }: Props = {}) => {
}
}

export default useMenuState

export const POPOVER_DEFAULTS = ({ maxHeight }: Props = {}) => {
return {
anchorOrigin: {
Expand All @@ -161,4 +163,12 @@ export const POPOVER_DEFAULTS = ({ maxHeight }: Props = {}) => {
>
}

export default useMenuState
const MenuStateContext = React.createContext<ReturnType<typeof useMenuState>>(
{} as ReturnType<typeof useMenuState>
)

export const MenuStateProvider = MenuStateContext.Provider

export function useMenuStateContext() {
return React.useContext(MenuStateContext)
}

0 comments on commit 8dbf8cc

Please sign in to comment.