29 lines
573 B
TypeScript
29 lines
573 B
TypeScript
"use client"
|
|
|
|
import { createContext, useContext } from "react"
|
|
|
|
type InspectionContextValue = {
|
|
id: string
|
|
label: string
|
|
}
|
|
|
|
const InspectionContext = createContext<InspectionContextValue | null>(null)
|
|
|
|
export function InspectionProvider({
|
|
inspection,
|
|
children,
|
|
}: {
|
|
inspection: InspectionContextValue
|
|
children: React.ReactNode
|
|
}) {
|
|
return (
|
|
<InspectionContext.Provider value={inspection}>
|
|
{children}
|
|
</InspectionContext.Provider>
|
|
)
|
|
}
|
|
|
|
export function useInspection() {
|
|
return useContext(InspectionContext)
|
|
}
|