fix: expand tag column on truncated post (#5667)

This commit is contained in:
Alexey Pyltsyn 2021-10-14 10:54:57 +03:00 committed by GitHub
parent 99f6e665e8
commit 00bb405b89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View file

@ -63,6 +63,8 @@ function BlogPostItem(props: Props): JSX.Element {
} = metadata; } = metadata;
const image = assets.image ?? frontMatter.image; const image = assets.image ?? frontMatter.image;
const truncatedPost = !isBlogPostPage && truncated;
const tagsExists = tags.length > 0;
const renderPostHeader = () => { const renderPostHeader = () => {
const TitleHeading = isBlogPostPage ? 'h1' : 'h2'; const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
@ -111,13 +113,13 @@ function BlogPostItem(props: Props): JSX.Element {
<MDXProvider components={MDXComponents}>{children}</MDXProvider> <MDXProvider components={MDXComponents}>{children}</MDXProvider>
</div> </div>
{(tags.length > 0 || truncated) && ( {(tagsExists || truncated) && (
<footer <footer
className={clsx('row docusaurus-mt-lg', { className={clsx('row docusaurus-mt-lg', {
[styles.blogPostDetailsFull]: isBlogPostPage, [styles.blogPostDetailsFull]: isBlogPostPage,
})}> })}>
{tags.length > 0 && ( {tagsExists && (
<div className={clsx('col', {'col--9': !isBlogPostPage})}> <div className={clsx('col', {'col--9': truncatedPost})}>
<TagsListInline tags={tags} /> <TagsListInline tags={tags} />
</div> </div>
)} )}
@ -128,8 +130,11 @@ function BlogPostItem(props: Props): JSX.Element {
</div> </div>
)} )}
{!isBlogPostPage && truncated && ( {truncatedPost && (
<div className="col col--3 text--right"> <div
className={clsx('col text--right', {
'col--3': tagsExists,
})}>
<Link <Link
to={metadata.permalink} to={metadata.permalink}
aria-label={`Read more about ${title}`}> aria-label={`Read more about ${title}`}>

View file

@ -4,6 +4,16 @@ authors:
- name: Josh-Cena - name: Josh-Cena
image_url: https://avatars.githubusercontent.com/u/55398995?v=4 image_url: https://avatars.githubusercontent.com/u/55398995?v=4
url: https://joshcena.com url: https://joshcena.com
tags:
[
blog,
docusaurus,
long,
long-long,
long-long-long,
long-long-long-long,
long-long-long-long-long,
]
--- ---
# Multiple authors # Multiple authors

View file

@ -2,6 +2,7 @@
title: Blog post MDX Feed tests title: Blog post MDX Feed tests
authors: authors:
- slorber - slorber
tags: [blog, docusaurus, long-long, long-long-long, long-long-long-long]
--- ---
Some MDX tests, mostly to test how the RSS feed render those Some MDX tests, mostly to test how the RSS feed render those