import { create } from 'zustand'

type SideNavState = {
  sideNavIsOpen: boolean
  setSideNavIsOpen: (value: boolean) => void
  reset: () => void
}

type InitialState = {
  sideNavIsOpen: boolean
}

const initialState: InitialState = {
  sideNavIsOpen: false,
}

export const useSideNavState = create<SideNavState>((set) => ({
  ...initialState,
  setSideNavIsOpen: (value: boolean) => set((state) => ({ ...state, sideNavIsOpen: value })),
  reset: () => set(initialState),
}))
