"use client"; /** * Small shared card used by card-style blocks (bookmark fallback, * table-of-contents entries, link-to-page previews, database previews). * * Kept deliberately generic: icon + title + meta + optional action, with a * hover affordance and an optional onClick for the whole card. */ import type { ReactNode } from "react"; import { cn } from "@/lib/utils"; export interface BlockCardProps { icon?: ReactNode; title: string; meta?: string; description?: string; href?: string; onClick?: () => void; /** Render as a link card (external styling) vs. an action card. */ variant?: "link" | "action"; className?: string; children?: ReactNode; } export function BlockCard({ icon, title, meta, description, href, onClick, variant = "action", className, children }: BlockCardProps) { const body = ( <> {icon ? ( {icon} ) : null} {title} {meta ? {meta} : null} {description ? ( {description} ) : null} {children} ); const classes = cn( "group/card flex w-full gap-3 rounded-md border border-border p-3 text-left transition-colors", variant === "link" ? "bg-card hover:bg-accent/50" : "bg-card hover:border-ring/60", className ); if (href) { const external = href.startsWith("http"); return ( {body} ); } return ( ); }