import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { bool, str } from './parts.js';
/** A short author biography block, driven by the post's author context. */
export function AuthorBioSection({ section, context, }) {
    const c = section.content;
    const heading = str(c, 'heading', 'About the author');
    const showAvatar = bool(c, 'showAvatar', true);
    const showSocial = bool(c, 'showSocial', true);
    const name = context?.author?.name || 'Author name';
    const bio = context?.author?.bio || "The author's bio will appear here once it is set on their profile.";
    const avatarUrl = context?.author?.avatarUrl;
    const initials = name
        .split(/\s+/)
        .map((p) => p[0] ?? '')
        .join('')
        .slice(0, 2)
        .toUpperCase();
    return (_jsx("div", { className: "mx-auto max-w-3xl px-6", children: _jsxs("div", { className: "border-border bg-muted flex items-start gap-4 rounded-xl border p-5", children: [showAvatar &&
                    (avatarUrl ? (_jsx("img", { src: avatarUrl, alt: name, className: "h-14 w-14 shrink-0 rounded-full object-cover" })) : (_jsx("span", { className: "bg-brand/10 text-brand flex h-14 w-14 shrink-0 items-center justify-center rounded-full text-sm font-medium", children: initials || '?' }))), _jsxs("div", { className: "min-w-0", children: [heading && (_jsx("p", { className: "text-muted-foreground text-xs font-semibold tracking-wider uppercase", children: heading })), _jsx("p", { className: "text-foreground mt-0.5 text-base font-medium", children: name }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm leading-relaxed", children: bio }), showSocial && (_jsxs("div", { className: "text-brand mt-2 flex gap-3 text-sm", children: [_jsx("span", { children: "Twitter" }), _jsx("span", { children: "LinkedIn" })] }))] })] }) }));
}
//# sourceMappingURL=AuthorBioSection.js.map