Files
o2o-weather/frontend/src/b/sheetContext.ts
T
minaChoi 58c9d38474 Revert "chore: feat/legal 병합"
This reverts commit 343e3ee2fb, reversing
changes made to f9e927aece.
2026-10-08 09:23:30 +09:00

26 lines
784 B
TypeScript

import { createContext, use } from 'react'
export type SharePayload = { title: string; slides: HTMLElement[] }
type CommentsState = { type: 'comments'; postId: number; draft?: string }
export type SheetState =
| { type: 'gak'; indexId: number }
| { type: 'article'; articleId: number }
| { type: 'share'; share: SharePayload }
| CommentsState
| { type: 'seasonWeek' }
| { type: 'login'; then?: CommentsState }
| { type: 'me' }
| { type: 'region' }
| null
export type SheetApi = { open: (s: Exclude<SheetState, null>) => void; close: () => void }
export const SheetContext = createContext<SheetApi | null>(null)
export function useSheet() {
const ctx = use(SheetContext)
if (!ctx) throw new Error('useSheet must be used inside SheetProvider')
return ctx
}