overleaf/services/web/frontend/js/features/ide-react/context/review-panel/review-panel-context.tsx
ilkin-overleaf 7db5d761ea Merge pull request #15557 from overleaf/ii-ide-page-prototype-review-panel-track-changes
Review panel track changes for React IDE page

GitOrigin-RevId: d061596581ff10bd897b286dcd5c280ce79a6384
2023-11-17 09:03:02 +00:00

23 lines
916 B
TypeScript

import { createContext } from 'react'
import useReviewPanelState from '@/features/ide-react/context/review-panel/hooks/use-review-panel-state'
import { ReviewPanelStateReactIde } from '@/features/ide-react/context/review-panel/types/review-panel-state'
export const ReviewPanelReactIdeValueContext = createContext<
ReviewPanelStateReactIde['values'] | undefined
>(undefined)
export const ReviewPanelReactIdeUpdaterFnsContext = createContext<
ReviewPanelStateReactIde['updaterFns'] | undefined
>(undefined)
export const ReviewPanelReactIdeProvider: React.FC = ({ children }) => {
const { values, updaterFns } = useReviewPanelState()
return (
<ReviewPanelReactIdeValueContext.Provider value={values}>
<ReviewPanelReactIdeUpdaterFnsContext.Provider value={updaterFns}>
{children}
</ReviewPanelReactIdeUpdaterFnsContext.Provider>
</ReviewPanelReactIdeValueContext.Provider>
)
}