MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / WindowImage

Function WindowImage

apps/public/src/components/window-image.tsx:14–73  ·  view source on GitHub ↗
({
  src,
  srcDark,
  srcLight,
  alt,
  caption,
  className,
}: WindowImageProps)

Source from the content-addressed store, hash-verified

12}
13
14export function WindowImage({
15 src,
16 srcDark,
17 srcLight,
18 alt,
19 caption,
20 className,
21}: WindowImageProps) {
22 // If src is provided, use it for both (backward compatibility)
23 // Otherwise, use srcDark and srcLight
24 const darkSrc = srcDark || src;
25 const lightSrc = srcLight || src;
26
27 if (!darkSrc || !lightSrc) {
28 throw new Error(
29 'WindowImage requires either src or both srcDark and srcLight',
30 );
31 }
32
33 return (
34 <FeatureCardContainer
35 className={cn([
36 'overflow-hidden rounded-lg border border-border bg-foreground/10 shadow-lg/5 relative z-10 [@media(min-width:1100px)]:-mx-16 p-4 md:p-16',
37 className,
38 ])}
39 >
40 <div className="rounded-lg overflow-hidden p-2 bg-card/80 border col gap-2 relative">
41 {/* Window controls */}
42 <div className="flex items-center gap-2">
43 <div className="flex gap-1.5">
44 <div className="size-2 rounded-full bg-red-500" />
45 <div className="size-2 rounded-full bg-yellow-500" />
46 <div className="size-2 rounded-full bg-green-500" />
47 </div>
48 </div>
49 <div className="relative w-full border rounded-md overflow-hidden">
50 <Image
51 src={darkSrc}
52 alt={alt}
53 width={1200}
54 height={800}
55 className="hidden dark:block w-full h-auto"
56 />
57 <Image
58 src={lightSrc}
59 alt={alt}
60 width={1200}
61 height={800}
62 className="dark:hidden w-full h-auto"
63 />
64 </div>
65 </div>
66 {caption && (
67 <figcaption className="text-center text-sm text-muted-foreground max-w-lg mx-auto">
68 {caption}
69 </figcaption>
70 )}
71 </FeatureCardContainer>

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected