--- // Terminal.astro // A component that displays terminal-like interface with animated commands and outputs export interface Props { title?: string; height?: string; showTitleBar?: boolean; showPrompt?: boolean; commands?: { prompt: string; command: string; output?: string[]; delay?: number; }[]; } const { title = "terminal", height = "auto", showTitleBar = true, showPrompt = true, commands = [] } = Astro.props; // Make the last command have the typing effect const lastIndex = commands.length - 1; ---
{showTitleBar && (
{title}
)}
{commands.map((cmd, index) => (
{cmd.prompt} {cmd.command}
{cmd.output && cmd.output.length > 0 && (
{cmd.output.map((line) => (
{/* set:html={line} */} {line}
{/* Temporarily render raw line */} ))}
)}
))}