);
},
diff --git a/core/app/components/FormBuilder/FormBuilder.tsx b/core/app/components/FormBuilder/FormBuilder.tsx
index 5a718375f..d3c4205bd 100644
--- a/core/app/components/FormBuilder/FormBuilder.tsx
+++ b/core/app/components/FormBuilder/FormBuilder.tsx
@@ -24,6 +24,7 @@ import type { FormBuilderSchema, FormElementData, PanelEvent, PanelState } from
import type { Form as PubForm } from "~/lib/server/form";
import { renderWithPubTokens } from "~/lib/server/render/pub/renderWithPubTokens";
import { didSucceed, useServerAction } from "~/lib/serverActions";
+import { PanelHeader, PanelWrapper, SidePanel } from "../SidePanel";
import { saveForm } from "./actions";
import { ElementPanel } from "./ElementPanel";
import { FormBuilderProvider, useFormBuilder } from "./FormBuilderContext";
@@ -95,49 +96,12 @@ const elementPanelTitles: Record = {
editingButton: "Edit Submission Button",
};
-const PanelHeader = ({ state }: { state: PanelState["state"] }) => {
- const { dispatch } = useFormBuilder();
- return (
- <>
-
-
{elementPanelTitles[state]}
- {state !== "initial" && (
-
- )}
-
-
- >
- );
-};
-
type Props = {
pubForm: PubForm;
id: string;
stages: Stages[];
};
-// Render children in a portal so they can safely use
-
+
+ dispatch({ eventName: "cancel" })
+ }
+ />
@@ -351,10 +325,7 @@ export function FormBuilder({ pubForm, id, stages }: Props) {
Preview your form here
-
+
);
diff --git a/core/app/components/SidePanel.tsx b/core/app/components/SidePanel.tsx
new file mode 100644
index 000000000..3bdcba73a
--- /dev/null
+++ b/core/app/components/SidePanel.tsx
@@ -0,0 +1,67 @@
+import { forwardRef } from "react";
+import { createPortal } from "react-dom";
+
+import { Button } from "ui/button";
+import { X } from "ui/icon";
+import { cn } from "utils";
+
+// Render children in a portal so they can safely use