/
githubmirror
/
marktext
Обзор
Документация
Войти
/
githubmirror
/
marktext
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/website/src/components/docs/sidebar-context.ts
16 строк
423 B
Ran Luo
refactor(website): simplify docs subtree (palette / sidebar / markdown / nav) (#4349)
02 июн 2026, 19:36
Не верифицирован
02 июн 2026, 19:36
8544b10
Код
Авторство
О чём код?
'use client' import { createContext, useContext } from 'react' type SidebarContextValue = { open: boolean setOpen: (open: boolean) => void } export const SidebarContext = createContext<SidebarContextValue | null>(null) export function useSidebar(): SidebarContextValue { const ctx = useContext(SidebarContext) if (!ctx) throw new Error('useSidebar must be used within <SidebarContext.Provider>') return ctx }