teqo/src/components/campaign/dashboard/HomeSearchContext.tsx
Francisco Ignácio Fontoura Solla 7bb7b5e261 B47: staff-only home search input with focused mode hiding action strip.
Debounced omnibox chassis and empty results region for B48+; no hit providers yet.
2026-07-29 15:31:46 -03:00

25 lines
734 B
TypeScript

'use client'
import { createContext, useContext, type ReactNode } from 'react'
import type { HomeSearchController } from '@/components/campaign/dashboard/useHomeSearchQuery'
export type HomeSearchContextValue = HomeSearchController
const HomeSearchContext = createContext<HomeSearchContextValue | null>(null)
export const HomeSearchProvider = ({
value,
children,
}: {
value: HomeSearchContextValue
children: ReactNode
}) => <HomeSearchContext.Provider value={value}>{children}</HomeSearchContext.Provider>
export const useHomeSearch = (): HomeSearchContextValue => {
const ctx = useContext(HomeSearchContext)
if (!ctx) {
throw new Error('useHomeSearch must be used within HomeSearchProvider')
}
return ctx
}