mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
27 lines
614 B
TypeScript
27 lines
614 B
TypeScript
import { createContext, useContext } from "react";
|
|
import { create } from "zustand";
|
|
|
|
export const IsInsideMobileNavigationContext = createContext(false);
|
|
|
|
export const useIsInsideMobileNavigation = (): boolean => {
|
|
return useContext(IsInsideMobileNavigationContext);
|
|
};
|
|
|
|
export const useMobileNavigationStore = create<{
|
|
isOpen: boolean;
|
|
open: () => void;
|
|
close: () => void;
|
|
toggle: () => void;
|
|
}>()((set) => ({
|
|
isOpen: false,
|
|
open: () => {
|
|
set({ isOpen: true });
|
|
},
|
|
close: () => {
|
|
set({ isOpen: false });
|
|
},
|
|
toggle: () => {
|
|
set((state) => ({ isOpen: !state.isOpen }));
|
|
},
|
|
}));
|