From c0e769c1fa79fd2045ebe0848ef7be0758fe7799 Mon Sep 17 00:00:00 2001 From: SnapOtter Date: Fri, 8 May 2026 16:38:18 +0800 Subject: [PATCH] feat(videos): add TerminalWindow component with macOS chrome --- apps/videos/src/components/TerminalWindow.tsx | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 apps/videos/src/components/TerminalWindow.tsx diff --git a/apps/videos/src/components/TerminalWindow.tsx b/apps/videos/src/components/TerminalWindow.tsx new file mode 100644 index 00000000..1323dc46 --- /dev/null +++ b/apps/videos/src/components/TerminalWindow.tsx @@ -0,0 +1,116 @@ +import type React from "react"; +import { FONT } from "@/lib/fonts"; + +const TRAFFIC_LIGHTS = [ + { color: "#ff5f57", key: "red" }, + { color: "#febc2e", key: "yellow" }, + { color: "#28c840", key: "green" }, +]; + +export const TerminalWindow: React.FC<{ + width: number; + height: number; + title?: string; + style?: React.CSSProperties; + children?: React.ReactNode; + /** Opacity for traffic light dots (0-1), used for morph transitions */ + dotsOpacity?: number; + /** Override top bar background color */ + topBarColor?: string; + /** Override body background color */ + bodyColor?: string; + /** Optional element to render in the title area instead of plain text */ + titleElement?: React.ReactNode; +}> = ({ + width, + height, + title = "Terminal", + style, + children, + dotsOpacity = 1, + topBarColor = "#1e1e2e", + bodyColor = "#0d1117", + titleElement, +}) => { + return ( +
+ {/* Top bar */} +
+ {/* Traffic light dots */} +
+ {TRAFFIC_LIGHTS.map((dot) => ( +
+ ))} +
+ + {/* Title area (centered) */} +
+ {titleElement || ( + + {title} + + )} +
+
+ + {/* Body */} +
+ {children} +
+
+ ); +};