// ============================================================ // ARTICLE — Single article page // ============================================================ function Article({ slug }) { const [article, setArticle] = useState(null); const [related, setRelated] = useState([]); const [categories, setCategories] = useState([]); const [notFound, setNotFound] = useState(false); const [copied, setCopied] = useState(false); useEffect(() => { api.listCategories().then(setCategories); api.getArticle(slug).then(a => { if (!a) { setNotFound(true); return; } setArticle(a); // related from same category api.listArticles({ status: 'published', category: a.category }).then(list => { setRelated(list.filter(x => x.id !== a.id).slice(0, 3)); }); }); }, [slug]); if (notFound) { return (
404 · Sem manchete

Este artigo não foi encontrado.

← Voltar à capa
); } if (!article) { return (
Carregando edição…
); } const cat = categoryById(article.category); const shareUrl = window.location.href; const shareTitle = article.title; const shareWA = () => window.open(`https://wa.me/?text=${encodeURIComponent(shareTitle + ' — ' + shareUrl)}`, '_blank'); const shareX = () => window.open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(shareTitle)}&url=${encodeURIComponent(shareUrl)}`, '_blank'); const shareIn = () => window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(shareUrl)}`, '_blank'); const copyLink= () => { navigator.clipboard?.writeText(shareUrl); setCopied(true); setTimeout(() => setCopied(false), 1500); }; return (
{cat && {cat.name}}

{article.title}

{article.subtitle}

Por {article.author} {fmtDateLong(article.publishedAt)} {readingTime(article.body)} min de leitura
{article.cover && (
{article.coverCaption &&
{article.coverCaption}
}
)}
{/* Share rail */}
{/* right gutter */}
{/* Tags */} {article.tags && article.tags.length > 0 && (
Etiquetas {article.tags.map(t => ( {t} ))}
)} {/* Author bio */}

Dr. Angelo Santos

Advogado Criminalista · OAB-SP 377.580

Pós-graduado em Ciências Criminais pela PUC-MG e ex-representante da OAB Santos na Comissão de Política de Drogas. Mais de uma década atuando em defesa criminal, com mais de 300 casos em tribunal.

{/* Related */} {related.length > 0 && (

Leia também

{related.map(a => )}
)} {/* Sticky consultation CTA */} Consultar Dr. Angelo
); } // ---------- Hedcut-style portrait (stylized SVG) ---------- function HedcutAvatar() { return ( ); } Object.assign(window, { Article, HedcutAvatar });