MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getIframeContent

Function getIframeContent

web/src/components/TerminalDemo.tsx:53–175  ·  view source on GitHub ↗
(
  content: string,
  showError: boolean,
  isRainbow: boolean,
  theme: PreviewTheme,
)

Source from the content-addressed store, hash-verified

51}
52
53const getIframeContent = (
54 content: string,
55 showError: boolean,
56 isRainbow: boolean,
57 theme: PreviewTheme,
58) => {
59 const styles = `
60 <style>
61 body {
62 margin: 0;
63 padding: 16px;
64 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
65 font-size: 14px;
66 ${
67 theme === 'light'
68 ? `
69 background: white;
70 color: #111827;
71 `
72 : theme === 'terminal-y'
73 ? `
74 background: black;
75 color: #10B981;
76 `
77 : theme === 'retro'
78 ? `
79 background: #002448;
80 color: #FFB000;
81 text-shadow: 2px 0 0 rgba(255,176,0,0.6);
82 animation: textflicker 0.1s infinite;
83 `
84 : `
85 background: transparent;
86 color: inherit;
87 `
88 }
89 }
90 @keyframes textflicker {
91 0% { opacity: 0.95; text-shadow: 2px 0 0 rgba(255,176,0,0.6); }
92 25% { opacity: 0.92; text-shadow: -2px 0 0 rgba(255,176,0,0.6); }
93 50% { opacity: 0.94; text-shadow: 2px 0 0 rgba(255,176,0,0.6); }
94 75% { opacity: 0.91; text-shadow: -2px 0 0 rgba(255,176,0,0.6); }
95 100% { opacity: 0.95; text-shadow: 2px 0 0 rgba(255,176,0,0.6); }
96 }
97 .error { color: #EF4444; }
98 .error-box {
99 background: rgba(239,68,68,0.1);
100 padding: 16px;
101 border-radius: 6px;
102 margin: 8px 0;
103 }
104 .success { color: #10B981; }
105 h1 { font-size: 24px; margin-bottom: 16px; }
106 p { margin: 8px 0; }
107 .dim { opacity: 0.75; }
108 </style>
109 `
110

Callers 1

BrowserPreviewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected