Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

610 B
Raw Blame
'use client'

import { createContext, useContext } from 'react'

export interface MobileSidebarContextType {
  open: boolean
  setOpen: (open: boolean) => void
  toggle: () => void
}

export const MobileSidebarContext = createContext<MobileSidebarContextType | null>(null)

export function useMobileSidebar(): MobileSidebarContextType {
  const context = useContext(MobileSidebarContext)

  if (context === null) {
    throw new Error(
      'useMobileSidebar must be used within a MobileSidebarProvider. ' +
        'Ensure your component is wrapped with MobileSidebarProvider.'
    )
  }

  return context
}