From 778545a468f6323a867c81c3982980fc6af35216 Mon Sep 17 00:00:00 2001 From: Ali Fayed Date: Tue, 8 Sep 2026 22:14:16 -0700 Subject: [PATCH] fix(ui): add a copy button to the terminal CodeBlock variant --- packages/ui/src/components/code-block.test.tsx | 5 +++++ packages/ui/src/components/code-block.tsx | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/ui/src/components/code-block.test.tsx b/packages/ui/src/components/code-block.test.tsx index 91e7e54..e7c9fc0 100644 --- a/packages/ui/src/components/code-block.test.tsx +++ b/packages/ui/src/components/code-block.test.tsx @@ -48,6 +48,11 @@ describe("CodeBlock — terminal variant", () => { expect(container.querySelector('[class*="ff5f56"]')).toBeNull(); }); + it("renders a copy button, same as the editor variant", () => { + render(); + expect(screen.getByRole("button", { name: "Copy" })).toBeInTheDocument(); + }); + it("falls back to the localized TERMINAL title when no lang is given", () => { render(); expect(screen.getByText("Terminal")).toBeInTheDocument(); diff --git a/packages/ui/src/components/code-block.tsx b/packages/ui/src/components/code-block.tsx index 1abdd81..a34614a 100644 --- a/packages/ui/src/components/code-block.tsx +++ b/packages/ui/src/components/code-block.tsx @@ -175,6 +175,7 @@ export function CodeBlock({ style={elev} > {lang ?? m.codeBlock.terminal} +
           {body}