mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
33 lines
864 B
TypeScript
33 lines
864 B
TypeScript
import { createContext, HTMLAttributes, useContext } from 'react';
|
|
|
|
export interface NavBarItemMenuContextProps {
|
|
menuHasFocus: boolean;
|
|
onClose: () => void;
|
|
onLeft: () => void;
|
|
menuProps?: HTMLAttributes<HTMLElement>;
|
|
}
|
|
|
|
export const NavBarItemMenuContext = createContext<NavBarItemMenuContextProps>({
|
|
menuHasFocus: false,
|
|
onClose: () => undefined,
|
|
onLeft: () => undefined,
|
|
});
|
|
|
|
export function useNavBarItemMenuContext(): NavBarItemMenuContextProps {
|
|
return useContext(NavBarItemMenuContext);
|
|
}
|
|
|
|
export interface NavBarContextProps {
|
|
menuIdOpen: string | undefined;
|
|
setMenuIdOpen: (id: string | undefined) => void;
|
|
}
|
|
|
|
export const NavBarContext = createContext<NavBarContextProps>({
|
|
menuIdOpen: undefined,
|
|
setMenuIdOpen: () => undefined,
|
|
});
|
|
|
|
export function useNavBarContext(): NavBarContextProps {
|
|
return useContext(NavBarContext);
|
|
}
|