From c6bb9d7f7088e592d04a767f58ad061502c1228e Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Thu, 2 Nov 2023 19:48:09 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20correctly=20handle=20all=20blockquo?= =?UTF-8?q?te=20citation=20states?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/model/Gdoc/rawToEnriched.ts | 5 ++++- site/gdocs/ArticleBlock.tsx | 11 ++++++++--- site/gdocs/centered-article.scss | 9 ++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/db/model/Gdoc/rawToEnriched.ts b/db/model/Gdoc/rawToEnriched.ts index 1169f7db653..188eb0af36e 100644 --- a/db/model/Gdoc/rawToEnriched.ts +++ b/db/model/Gdoc/rawToEnriched.ts @@ -316,7 +316,10 @@ const parseBlockquote = (raw: RawBlockBlockquote): EnrichedBlockBlockquote => { parseErrors: [error], }) - if (typeof raw.value.citation !== "string") { + if ( + typeof raw.value.citation !== "undefined" && + typeof raw.value.citation !== "string" + ) { return createError({ message: "Citation is not a string", }) diff --git a/site/gdocs/ArticleBlock.tsx b/site/gdocs/ArticleBlock.tsx index 142640dfe83..0bd3be5fffb 100644 --- a/site/gdocs/ArticleBlock.tsx +++ b/site/gdocs/ArticleBlock.tsx @@ -588,12 +588,17 @@ export default function ArticleBlock({ /> )) .with({ type: "blockquote" }, (block) => { + // If the citation exists and is a URL, it uses the cite attribute + // If the citation exists and is not a URL, it uses the footer + // Otherwise, we show nothing for cases where the citation is written in the surrounding text const isCitationAUrl = Boolean( block.citation && block.citation.startsWith("http") ) + const shouldShowCitationInFooter = block.citation && !isCitationAUrl const blockquoteProps = isCitationAUrl ? { cite: block.citation } : {} + return (
))} - {isCitationAUrl ? null : ( + {shouldShowCitationInFooter ? ( - )} + ) : null}
) }) diff --git a/site/gdocs/centered-article.scss b/site/gdocs/centered-article.scss index 00077de287b..6e5aa17cdef 100644 --- a/site/gdocs/centered-article.scss +++ b/site/gdocs/centered-article.scss @@ -72,12 +72,19 @@ $banner-height: 200px; .article-block__blockquote { margin-top: 0; + color: $blue-60; p { font-style: italic; &:last-of-type { - margin-bottom: 4px; + margin-bottom: 0px; } } + a { + color: $blue-60; + } + footer { + margin-top: 8px; + } cite { font-style: normal; }