Skip to content

Commit ed9dfd2

Browse files
committed
feat: Removed iframe and moved to container queries
1 parent 0d2836a commit ed9dfd2

5 files changed

Lines changed: 109 additions & 285 deletions

File tree

‎src/components/form-builder/dialogs/open-json-dialog.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function OpenJsonDialog() {
5959
Paste your form JSON code here. The JSON should be an array of rows with components.
6060
</DialogDescription>
6161
</DialogHeader>
62-
<div className="min-h-[500px] w-full overflow-y-auto flex flex-col gap-4">
62+
<div className="h-[500px] w-full overflow-y-auto flex flex-col gap-4">
6363
<Textarea
6464
value={jsonInput}
6565
onChange={(e) => setJsonInput(e.target.value)}

‎src/components/form-builder/helpers/iframe.tsx‎

Lines changed: 0 additions & 78 deletions
This file was deleted.

‎src/components/form-builder/mainCanvas.tsx‎

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { useFormBuilderStore } from "@/stores/form-builder-store";
44
import { useEffect, useRef, useMemo, memo } from "react";
55
import GenerateEditor from "./canvas/generate-editor";
6-
import { IFrame } from "./helpers/iframe";
76
import { Pre } from "@/components/ui/pre";
87
import { generateJsonSchema } from "./helpers/generate-json";
98
import { cn } from "@/lib/utils";
@@ -12,9 +11,9 @@ import { Card } from "../ui/card";
1211

1312
// Memoize static viewport styles
1413
const viewportEditorStyles = {
15-
sm: "w-[320px]",
16-
md: "w-[768px]",
17-
lg: "w-[1024px]",
14+
sm: "w-[370px]",
15+
md: "w-[818px]",
16+
lg: "w-[1074px]",
1817
} as const;
1918

2019
// Memoize the JSON preview component
@@ -80,22 +79,18 @@ export function MainCanvas() {
8079
}
8180
}}
8281
>
83-
<IFrame
84-
ref={editorIframeRef}
85-
className={cn(`${viewportEditorStyles[viewport]}`, "mx-auto")}
86-
onClick={() => {
87-
if (selectedComponent) {
88-
selectComponent(null);
89-
selectRow(null);
90-
}
91-
}}
82+
<Card
83+
className={cn(
84+
'transition-all duration-300',
85+
`${viewportEditorStyles[viewport]}`,
86+
"mx-auto scrollbar-hide mt-6"
87+
)}
9288
>
93-
<Card className="mt-6">
94-
<CardContent>
95-
<GenerateEditor />
96-
</CardContent>
97-
</Card>
98-
</IFrame>
89+
<CardContent className="@container">
90+
<GenerateEditor />
91+
</CardContent>
92+
</Card>
93+
9994
</div>
10095
{showJson && <JsonPreview rows={rows} />}
10196
</div>

‎src/config/allowed-tw-classes.ts‎

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)