Skip to content

Commit ac185f1

Browse files
authored
Fix styling on WebSocket example (#239)
* fix: add overflow handling to code samples in sandbox site Added overflow-auto classes to websocket example code block and CodeBlock component to prevent content from overflowing container boundaries. Removed flex centering classes from CodeBlock that were causing layout issues with scrollable content. * fix: indent and padding
1 parent be9ed8b commit ac185f1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sites/sandbox/src/code-sample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export const pythonExample = `<pre class="shiki custom-theme" style="background-
205205
<span class="line"><span style="color:var(--foreground)"> </span><span style="color:var(--foreground);font-weight:bold">print</span><span style="color:var(--foreground)">(</span><span style="color:var(--color-orange-800)">f"Hello Python! On step {i}"</span><span style="color:var(--foreground)">)</span></span>
206206
<span class="line"><span style="color:var(--foreground)"> </span><span style="color:var(--foreground);font-weight:bold">time</span><span style="color:var(--foreground)">.sleep(1)</span></span></code></pre>`;
207207

208-
export const websocketExample = `<pre class="shiki custom-theme" style="background-color:var(--background);color:var(--foreground)" tabindex="0"><code><span class="line"><span style="color:var(--foreground);font-weight:bold">import</span><span style="color:var(--foreground)"> { getSandbox, connect } </span><span style="color:var(--foreground);font-weight:bold">from</span><span style="color:var(--color-orange-800)"> '@cloudflare/sandbox'</span><span style="color:var(--foreground)">;</span></span>
208+
export const websocketExample = `<pre class="shiki custom-theme max-w-full overflow-auto" style="background-color:var(--background);color:var(--foreground)" tabindex="0"><code><span class="line"><span style="color:var(--foreground);font-weight:bold">import</span><span style="color:var(--foreground)"> { getSandbox, connect } </span><span style="color:var(--foreground);font-weight:bold">from</span><span style="color:var(--color-orange-800)"> '@cloudflare/sandbox'</span><span style="color:var(--foreground)">;</span></span>
209209
<span class="line"></span>
210210
<span class="line"><span style="color:var(--foreground);font-weight:bold">export</span><span style="color:var(--foreground);font-weight:bold"> default</span><span style="color:var(--foreground)"> {</span></span>
211211
<span class="line"><span style="color:var(--foreground)"> async fetch(request</span><span style="color:var(--foreground);font-weight:bold">:</span><span style="color:var(--foreground)"> Request, env</span><span style="color:var(--foreground);font-weight:bold">:</span><span style="color:var(--foreground)"> Env)</span><span style="color:var(--foreground);font-weight:bold"></span><span style="color:var(--foreground)"> {</span></span>

sites/sandbox/src/components/grid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function CodeBlock({ children }: { children: string }) {
131131
</button>
132132

133133
<div
134-
className="h-full w-full border bg-background flex items-center justify-center p-3 sm:p-4 min-w-0 min-h-0"
134+
className="h-full w-full border bg-background pl-6 sm:pl-8 pr-3 sm:pr-4 pt-8 sm:pt-12 pb-3 sm:pb-4 overflow-auto"
135135
// biome-ignore lint/security/noDangerouslySetInnerHtml: children is safe
136136
dangerouslySetInnerHTML={{ __html: children }}
137137
style={

0 commit comments

Comments
 (0)