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

Function BrowserPreview

web/src/components/BrowserPreview.tsx:12–159  ·  view source on GitHub ↗
({
  show,
  className,
  url = 'http://localhost:3000',
  variant = 'before',
}: BrowserPreviewProps)

Source from the content-addressed store, hash-verified

10}
11
12const BrowserPreview = ({
13 show,
14 className,
15 url = 'http://localhost:3000',
16 variant = 'before',
17}: BrowserPreviewProps) => {
18 return (
19 <div
20 className={cn(
21 'rounded-lg bg-white dark:bg-gray-900 flex flex-col flex-1',
22 className,
23 )}
24 >
25 {/* Browser-like title bar */}
26 <div className="bg-gray-100 dark:bg-gray-800 p-2 flex items-center gap-2 border-b border-gray-200 dark:border-gray-700">
27 {/* Traffic light circles */}
28 <div className="flex gap-1.5">
29 <div className="w-3 h-3 rounded-full bg-red-500"></div>
30 <div className="w-3 h-3 rounded-full bg-yellow-500"></div>
31 <div className="w-3 h-3 rounded-full bg-green-500"></div>
32 </div>
33 {/* URL bar */}
34 <div className="flex-1 ml-2">
35 <div className="bg-white dark:bg-gray-700 rounded px-3 py-1 text-sm text-gray-600 dark:text-gray-300 font-mono">
36 {url}
37 </div>
38 </div>
39 </div>
40 {/* Content area */}
41 <div className="flex-1 border rounded-b-lg border-gray-200 dark:border-gray-700 p-6">
42 {variant === 'before' ? (
43 <div
44 className="bg-gray-800 h-full w-full"
45 style={{ backgroundColor: '#222' }}
46 >
47 <div className="text-left p-6">
48 <h1 className="text-xl text-white mb-4 font-mono">Weather App</h1>
49
50 <div
51 className="p-4 mb-4 border border-gray-700"
52 style={{ backgroundColor: '#f0f0f0' }}
53 >
54 <p className="text-red-600 mb-3 font-medium font-mono">
55 Error: API Key Missing
56 </p>
57 <p className="text-gray-800 text-sm mb-4 font-mono">
58 Please configure the OpenWeatherMap API key to display weather
59 information.
60 </p>
61 </div>
62
63 <button className="px-4 py-1 bg-gray-700 border border-gray-600 text-gray-300 text-sm font-mono">
64 Configure API
65 </button>
66 </div>
67 </div>
68 ) : (
69 <div className="bg-gradient-to-br from-sky-100 to-indigo-100 dark:from-sky-900 dark:to-indigo-900 rounded-lg border border-blue-200 dark:border-blue-800 p-6 shadow-2xl">

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected