2024-06-04 11:02:59 -05:00
|
|
|
import { JSX, PropsWithChildren } from 'react';
|
2024-06-04 08:33:55 -05:00
|
|
|
|
|
|
|
import { createGenericContext } from './createGenericContext';
|
2024-06-04 11:02:59 -05:00
|
|
|
import { UseFigmaHook, useFigma } from './useFigma';
|
2024-06-04 08:33:55 -05:00
|
|
|
|
2024-06-04 11:02:59 -05:00
|
|
|
const [useFigmaContext, StateContextProvider] = createGenericContext<UseFigmaHook>();
|
2024-06-04 08:33:55 -05:00
|
|
|
|
|
|
|
const FigmaProvider = ({ children }: PropsWithChildren): JSX.Element => {
|
2024-06-04 11:02:59 -05:00
|
|
|
const hook = useFigma();
|
2024-06-04 08:33:55 -05:00
|
|
|
|
2024-06-04 11:02:59 -05:00
|
|
|
return <StateContextProvider value={hook}>{children}</StateContextProvider>;
|
2024-06-04 08:33:55 -05:00
|
|
|
};
|
|
|
|
|
2024-06-04 11:02:59 -05:00
|
|
|
export { FigmaProvider, useFigmaContext };
|