import { Save, X } from "lucide-react"; import { useResourceForm } from "../../hooks/use_resource_form.js"; import { useResource } from "../../providers/resource.js"; import { LayoutRenderer } from "../renderers/layout.js"; import { Button } from "../ui/button.js"; import { Island, IslandActions, IslandContent } from "../ui/island.js"; import { AnimatePresence } from "motion/react"; export const ResourceForm = ({ record, type, }: { type: "create" | "update"; record?: any; }) => { const { resource } = useResource(); const form = useResourceForm(record); return (
{resource.fields.map((layout, i) => ( ))} {(state) => ( {state.isDirty && ( You have unsaved values )} )}
); // return ( //
{ // e.preventDefault(); // e.stopPropagation(); // form.handleSubmit(); // }} // > //
// {resource.fields.map((field, i) => ( // // // // // {(formField) => ( // //
// //
// // {formField.state.meta.isDirty && ( // // // // )} // // // //
// //
// // // //
// //
// // )} // //
// ))} // //
//
// //
//
// // //
//
// // ); };