// CodeWindow — chrome'd code preview for the landing hero / feature // callouts. Looks like a terminal/editor surface without claiming a // specific platform (no fake macOS dots). // // Two states: // - Pass `code` (string) + `lang` for a plain (no-syntax) preview // - Pass `html` for pre-highlighted (e.g. Shiki) output // // A subtle blinking caret is appended at the end of the last line // when `caret` is true — adds the "live, just typed" feel without // real animation cost. import type { ReactNode } from 'react' import { cn } from '../cn' import { HighlightedCode, type ShikiLang } from './highlightedCode' interface CodeWindowProps { /** Title shown in the chrome — usually a filename. */ readonly title?: string /** Tag in the corner — language label, e.g. "TypeScript". */ readonly tag?: string /** Plain code text. When `lang` is also provided, the component * runs Shiki syntax highlighting automatically. */ readonly code?: string /** Shiki language. Triggers syntax highlighting on `code`. */ readonly lang?: ShikiLang /** Pre-highlighted HTML (skips Shiki). */ readonly html?: string /** Show a blinking caret after the code. Default false. Only * applies to plain (non-highlighted) rendering. */ readonly caret?: boolean /** Outer wrapper class — useful for sizing. */ readonly className?: string } export const CodeWindow = ({ title, tag, code, lang, html, caret = false, className, }: CodeWindowProps): ReactNode => (
{(title || tag) ? (
{/* Three soft indicator dots — not platform-specific colours */}
{tag ? ( {tag} ) : null}
) : null}
{html ? (
) : code && lang ? ( // `code + lang` → run Shiki transparently. ) : (
          {code}
          {caret ? (
            
          ) : null}
        
)}
)