mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 04:53:10 +00:00
Extract CampaignGlobalSearchMount (provider + body) from home chrome so the same home-search contract mounts in CampaignQuickActionsDrawer when expanded. Refactor CampaignHomeStaffChrome to use the provider. Closes #55 Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
23 lines
1 KiB
TypeScript
23 lines
1 KiB
TypeScript
'use client'
|
|
|
|
import type { ReactNode } from 'react'
|
|
|
|
import { CampaignStaffGlobalSearchBody } from '@/components/campaign/dashboard/CampaignStaffGlobalSearch'
|
|
import { HomeSearchProvider } from '@/components/campaign/dashboard/HomeSearchContext'
|
|
import { useHomeSearchQuery } from '@/components/campaign/dashboard/useHomeSearchQuery'
|
|
|
|
/** Owns debounce + focus state for any global search surface (Início, drawer B91). */
|
|
export const CampaignGlobalSearchProvider = ({ children }: { children: ReactNode }) => {
|
|
const searchState = useHomeSearchQuery()
|
|
return <HomeSearchProvider value={searchState}>{children}</HomeSearchProvider>
|
|
}
|
|
|
|
/** Input + result groups — requires `CampaignGlobalSearchProvider` unless using the mount. */
|
|
export const CampaignGlobalSearchBody = CampaignStaffGlobalSearchBody
|
|
|
|
/** Provider + default global search body (drawer, smoke tests). */
|
|
export const CampaignGlobalSearchMount = () => (
|
|
<CampaignGlobalSearchProvider>
|
|
<CampaignGlobalSearchBody />
|
|
</CampaignGlobalSearchProvider>
|
|
)
|