import {
   createContext,
   ReactNode,
   useContext,
} from 'react';

export type FormLayoutProps = {
   isTopHorizontal: boolean;
}

const formLayoutContext = createContext<FormLayoutProps>({
   isTopHorizontal: false,
});

export function FormLayoutProvider(props: { layout: FormLayoutProps; children?: ReactNode }) {
   const { layout, children } = props;

   return <formLayoutContext.Provider value={layout}>{children}</formLayoutContext.Provider>;
}

export function useFormLayout() {
   return useContext(formLayoutContext);
}
