Skip to content

Commit e0f540f

Browse files
authored
Refactor CanvasEmbed and CanvasEmbedDialog components (#1066)
- Updated CanvasEmbedPlaceholder to include a fixed height style. - Set a fixed height for the canvas embed wrapper in renderCanvasEmbed. - Renamed class for CanvasEmbedDialog to 'roamjs-canvas-dialog' and added a fixed width style. - Removed unused CSS classes related to canvas embed styles from styles.css. These changes improve the layout and styling consistency of the canvas embed feature.
1 parent eb1cd95 commit e0f540f

3 files changed

Lines changed: 7 additions & 25 deletions

File tree

apps/roam/src/components/canvas/CanvasEmbed.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ const extractCanvasTitle = (button: HTMLElement): string | null => {
2020
};
2121

2222
const CanvasEmbedPlaceholder = ({ message }: { message: string }) => (
23-
<div className="dg-canvas-embed-placeholder flex items-center justify-center rounded-md border border-dashed border-gray-300 text-sm text-[#8a9ba8]">
23+
<div
24+
className="flex items-center justify-center rounded-md border border-dashed border-gray-300 text-sm"
25+
style={{ height: "100px" }}
26+
>
2427
{message}
2528
</div>
2629
);
@@ -49,6 +52,7 @@ export const renderCanvasEmbed = (
4952

5053
const wrapper = document.createElement("div");
5154
wrapper.className = "dg-canvas-embed my-2 w-full overflow-hidden rounded-md";
55+
wrapper.style.height = "400px";
5256
wrapper.onmousedown = (e: MouseEvent) => e.stopPropagation();
5357
button.parentElement.appendChild(wrapper);
5458

apps/roam/src/components/canvas/CanvasEmbedDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ const CanvasEmbedDialog = ({
6565
isOpen={isOpen}
6666
onClose={onClose}
6767
title="Embed Canvas"
68-
className="dg-canvas-embed-dialog pb-0"
68+
className="roamjs-canvas-dialog pb-0"
69+
style={{ width: "400px" }}
6970
>
7071
<div className="p-4">{renderContent()}</div>
7172
</Dialog>

apps/roam/src/styles/styles.css

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,3 @@
191191
#dg-left-sidebar-root .bp3-dark .bp3-button:not([class*="bp3-intent-"]):hover {
192192
color: #f5f8fa;
193193
}
194-
195-
.dg-canvas-embed {
196-
height: 400px;
197-
}
198-
199-
.dg-canvas-embed > .roamjs-tldraw-canvas-container {
200-
height: 100%;
201-
width: 100%;
202-
}
203-
204-
.dg-canvas-embed-placeholder {
205-
height: 100px;
206-
}
207-
208-
.dg-canvas-embed-dialog.bp3-dialog {
209-
width: 400px;
210-
}
211-
212-
.dg-canvas-embed-dialog .roamjs-autocomplete-input-target,
213-
.dg-canvas-embed-dialog .roamjs-autocomplete-input-target .bp3-input-group {
214-
display: block;
215-
width: 100%;
216-
}

0 commit comments

Comments
 (0)