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: "flex items-start gap-4 rounded-xl border border-zinc-200 bg-zinc-50 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: "flex h-14 w-14 shrink-0 items-center justify-center rounded-full bg-violet-100 text-sm font-medium text-violet-700", children: initials || '?' }))), _jsxs("div", { className: "min-w-0", children: [heading && (_jsx("p", { className: "text-xs font-semibold tracking-wider text-zinc-500 uppercase", children: heading })), _jsx("p", { className: "mt-0.5 text-base font-medium text-zinc-900", children: name }), _jsx("p", { className: "mt-1 text-sm leading-relaxed text-zinc-600", children: bio }), showSocial && (_jsxs("div", { className: "mt-2 flex gap-3 text-sm text-violet-600", children: [_jsx("span", { children: "Twitter" }), _jsx("span", { children: "LinkedIn" })] }))] })] }) }));
}
//# sourceMappingURL=AuthorBioSection.js.map