Files
0pt/components/embed.tsx
T

40 lines
1.3 KiB
TypeScript

"use client";
// Renders an embedded NocoDB view or Metabase dashboard inside 0pt's mono chrome.
// The parent passes a server-generated SIGNED URL (docs/08) so the customer never
// sees a separate login. No raw credentials reach the client.
export function EmbeddedView({
src,
title,
height = 720,
}: {
src: string | null;
title: string;
height?: number;
}) {
return (
<div className="border border-border bg-background">
<div className="flex items-center justify-between border-b border-border px-4 py-2.5">
<span className="font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground">{title}</span>
<span className="inline-block h-1.5 w-1.5" style={{ backgroundColor: "var(--prov-3)" }} />
</div>
{src ? (
<iframe
src={src}
title={title}
className="w-full"
style={{ height, border: "0" }}
sandbox="allow-scripts allow-same-origin allow-forms allow-popups"
loading="lazy"
/>
) : (
<div className="flex items-center justify-center px-6 py-20 text-center">
<p className="font-mono text-[11px] uppercase tracking-[0.1em] text-muted-foreground">
Vyn aktiveras vid leverans.
</p>
</div>
)}
</div>
);
}