-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blockquote component #2885
Blockquote component #2885
Changes from 8 commits
be2ce44
18a54e8
569fa44
b24924d
e8f3a7a
75806af
1247ebc
d2a2867
c6bb9d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -587,6 +587,34 @@ export default function ArticleBlock({ | |
{...block} | ||
/> | ||
)) | ||
.with({ type: "blockquote" }, (block) => { | ||
const isCitationAUrl = Boolean( | ||
block.citation && block.citation.startsWith("http") | ||
) | ||
const blockquoteProps = isCitationAUrl | ||
? { cite: block.citation } | ||
: {} | ||
return ( | ||
<blockquote | ||
className={cx(getLayout("blockquote", containerType))} | ||
{...blockquoteProps} | ||
> | ||
{block.text.map((textBlock, i) => ( | ||
<Paragraph | ||
className="article-block__text" | ||
d={textBlock} | ||
key={i} | ||
/> | ||
))} | ||
|
||
{isCitationAUrl ? null : ( | ||
<footer> | ||
<cite>{block.citation}</cite> | ||
</footer> | ||
)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
</blockquote> | ||
) | ||
}) | ||
.exhaustive() | ||
|
||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,19 @@ $banner-height: 200px; | |
margin-top: 0; | ||
} | ||
|
||
.article-block__blockquote { | ||
margin-top: 0; | ||
p { | ||
font-style: italic; | ||
&:last-of-type { | ||
margin-bottom: 4px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we only need this margin if the footer/cite block is present, it might be better to make it the footer's responsibility to apply this margin? |
||
} | ||
} | ||
cite { | ||
font-style: normal; | ||
} | ||
} | ||
|
||
.article-block__heading { | ||
a.deep-link { | ||
position: absolute; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it right that
citation
is marked as optional here?