mirror of https://github.com/ctk-hq/ctk
feat: created `SuperFormProvider` component
parent
0fc42edb9c
commit
c2d130b011
@ -0,0 +1,27 @@
|
|||||||
|
import { FunctionComponent, ReactElement, ReactNode } from "react";
|
||||||
|
import { SuperFormContext } from "../contexts";
|
||||||
|
import TextField from "./global/FormElements/TextField";
|
||||||
|
|
||||||
|
export interface ISuperFormProviderProps {
|
||||||
|
children?: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const types: Record<string, FunctionComponent<any>> = {
|
||||||
|
text: TextField
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SuperFormProvider: FunctionComponent<ISuperFormProviderProps> = (
|
||||||
|
props: ISuperFormProviderProps
|
||||||
|
): ReactElement => {
|
||||||
|
const { children } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SuperFormContext.Provider
|
||||||
|
value={{
|
||||||
|
types
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</SuperFormContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue