From cf26f2853c5c4aa7b0eb72c3a24f5157fe464392 Mon Sep 17 00:00:00 2001 From: Shakitskiy Vladislav Date: Wed, 27 Dec 2023 15:15:22 +0300 Subject: [PATCH 1/5] fix: Elements Overlay and Deleting --- apps/dashboard/src/components/OgPlayground.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dashboard/src/components/OgPlayground.tsx b/apps/dashboard/src/components/OgPlayground.tsx index cd69cc9..2cb38de 100644 --- a/apps/dashboard/src/components/OgPlayground.tsx +++ b/apps/dashboard/src/components/OgPlayground.tsx @@ -176,7 +176,7 @@ export function OgPlayground({ initialElements, width, height }: OgProviderProps return } - if (event.key === 'Backspace' && selectedElement) { + if ((event.key === 'Backspace' || event.key === 'Delete') && selectedElement) { event.preventDefault() removeElement(selectedElement) } @@ -245,7 +245,7 @@ export function OgPlayground({ initialElements, width, height }: OgProviderProps return (
-
+
@@ -260,7 +260,7 @@ export function OgPlayground({ initialElements, width, height }: OgProviderProps
-
+
From 1f3e4cf8812e4e03d616dd2e5a39e226fc3e85b8 Mon Sep 17 00:00:00 2001 From: Shakitskiy Vladislav Date: Wed, 27 Dec 2023 16:52:05 +0300 Subject: [PATCH 2/5] fix: editor overflow & change elements type --- apps/dashboard/src/app/page.tsx | 1 + .../src/components/EditorToolbar.tsx | 5 ++ .../src/components/LeftPanel/ElementRow.tsx | 51 ++++++++----------- apps/dashboard/src/components/OgEditor.tsx | 2 +- apps/dashboard/src/lib/types.ts | 1 + 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/apps/dashboard/src/app/page.tsx b/apps/dashboard/src/app/page.tsx index d4726fa..6971fc1 100644 --- a/apps/dashboard/src/app/page.tsx +++ b/apps/dashboard/src/app/page.tsx @@ -13,6 +13,7 @@ const initialElements: OGElement[] = [ { id: createElementId(), tag: 'div', + name: 'Box', x: 0, y: 0, width: 1200, diff --git a/apps/dashboard/src/components/EditorToolbar.tsx b/apps/dashboard/src/components/EditorToolbar.tsx index 831646a..88feeec 100644 --- a/apps/dashboard/src/components/EditorToolbar.tsx +++ b/apps/dashboard/src/components/EditorToolbar.tsx @@ -28,6 +28,7 @@ export function EditorToolbar() {
{ setSelectedElement(element.id); }} type="button" > - {element.tag === 'p' ? ( - <> - - {element.content.slice(0, 25)} - - ) : null} - {element.tag === 'div' && element.backgroundImage ? ( - <> - - Image - - ) : null} - {element.tag === 'div' && !element.backgroundImage && !element.radius ? ( - <> - - Box - - ) : null} - {element.tag === 'div' && !element.backgroundImage && element.radius ? ( - <> - - Rounded box - - ) : null} - {element.tag === 'span' ? ( - <> - - Dynamic text - - ) : null} + {element.tag === 'p' + ? + : null + } + {element.tag === 'div' && element.backgroundImage + ? + : null + } + {element.tag === 'div' && !element.backgroundImage && !element.radius + ? + : null + } + {element.tag === 'div' && !element.backgroundImage && element.radius + ? + : null + } + {element.tag === 'span' + ? + : null + } + {element.name}