'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function TextPreview({ data, variant = 'prose' }) {
    const body = data.body || '';
    const heading = data.heading || '';
    const headingLevel = data.headingLevel || 'h2';
    const truncatedBody = body.length > 300 ? body.slice(0, 300) + '…' : body;
    const validLevels = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
    const HeadingTag = (validLevels.includes(headingLevel) ? headingLevel : 'h2');
    const headingSizeClass = HeadingTag === 'h1' ? 'text-2xl' : HeadingTag === 'h2' ? 'text-xl' : 'text-lg';
    if (variant === 'two-column') {
        const midpoint = Math.ceil(truncatedBody.length / 2);
        const col1 = truncatedBody.slice(0, midpoint);
        const col2 = truncatedBody.slice(midpoint);
        return (_jsxs("div", { className: "border-border rounded-md border p-5", children: [heading && (_jsx(HeadingTag, { className: `${headingSizeClass} text-foreground mb-3 font-medium`, children: heading })), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("p", { className: "text-muted-foreground text-sm leading-relaxed", children: col1 || 'Column one text content…' }), _jsx("p", { className: "text-muted-foreground text-sm leading-relaxed", children: col2 || 'Column two text content…' })] })] }));
    }
    if (variant === 'with-sidebar') {
        return (_jsxs("div", { className: "border-border grid grid-cols-[1fr_200px] gap-4 rounded-md border p-5", children: [_jsxs("div", { children: [heading && (_jsx(HeadingTag, { className: `${headingSizeClass} text-foreground mb-3 font-medium`, children: heading })), _jsx("p", { className: "text-muted-foreground text-sm leading-relaxed", children: truncatedBody || 'Body text content goes here…' })] }), _jsxs("aside", { className: "bg-muted rounded-md p-3", children: [_jsx("div", { className: "bg-border h-3 w-3/4 rounded" }), _jsx("div", { className: "bg-border mt-2 h-2 w-full rounded" }), _jsx("div", { className: "bg-border mt-1 h-2 w-2/3 rounded" })] })] }));
    }
    return (_jsxs("div", { className: "border-border rounded-md border p-5", children: [heading && (_jsx(HeadingTag, { className: `${headingSizeClass} text-foreground mb-3 font-medium`, children: heading })), _jsx("p", { className: "text-muted-foreground text-sm leading-relaxed", children: truncatedBody || _jsx("span", { className: "italic", children: "Body text content goes here\u2026" }) })] }));
}
//# sourceMappingURL=TextPreview.js.map