-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ea9ea4
commit d33079a
Showing
33 changed files
with
368 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from "react" | ||
import type {Props} from "@theme/BlogPostItem/Container" | ||
|
||
export default function BlogPostItemContainer({children, className}: Props): JSX.Element { | ||
return <article className={className}>{children}</article> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react" | ||
import clsx from "clsx" | ||
import {blogPostContainerID} from "@docusaurus/utils-common" | ||
import {useBlogPost} from "@docusaurus/theme-common/internal" | ||
import MDXContent from "@theme/MDXContent" | ||
import type {Props} from "@theme/BlogPostItem/Content" | ||
|
||
export default function BlogPostItemContent({children, className}: Props): JSX.Element { | ||
const {isBlogPostPage} = useBlogPost() | ||
return ( | ||
<div | ||
// This ID is used for the feed generation to locate the main content | ||
id={isBlogPostPage ? blogPostContainerID : undefined} | ||
className={clsx("markdown", className)} | ||
> | ||
<MDXContent>{children}</MDXContent> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from "react" | ||
import Translate, {translate} from "@docusaurus/Translate" | ||
import Link from "@docusaurus/Link" | ||
import type {Props} from "@theme/BlogPostItem/Footer/ReadMoreLink" | ||
|
||
function ReadMoreLabel() { | ||
return ( | ||
<b> | ||
<Translate | ||
id="theme.blog.post.readMore" | ||
description="The label used in blog post item excerpts to link to full blog posts" | ||
> | ||
Read More | ||
</Translate> | ||
</b> | ||
) | ||
} | ||
|
||
export default function BlogPostItemFooterReadMoreLink(props: Props): JSX.Element { | ||
const {blogPostTitle, ...linkProps} = props | ||
return ( | ||
<Link | ||
aria-label={translate( | ||
{ | ||
message: "Read more about {title}", | ||
id: "theme.blog.post.readMoreLabel", | ||
description: "The ARIA label for the link to full blog posts from excerpts", | ||
}, | ||
{title: blogPostTitle}, | ||
)} | ||
{...linkProps} | ||
> | ||
<ReadMoreLabel /> | ||
</Link> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from "react" | ||
import clsx from "clsx" | ||
import {useBlogPost} from "@docusaurus/theme-common/internal" | ||
import {ThemeClassNames} from "@docusaurus/theme-common" | ||
import EditMetaRow from "@theme/EditMetaRow" | ||
import TagsListInline from "@theme/TagsListInline" | ||
import ReadMoreLink from "@theme/BlogPostItem/Footer/ReadMoreLink" | ||
|
||
export default function BlogPostItemFooter(): JSX.Element | null { | ||
const {metadata, isBlogPostPage} = useBlogPost() | ||
const {tags, title, editUrl, hasTruncateMarker, lastUpdatedBy, lastUpdatedAt} = metadata | ||
|
||
// A post is truncated if it's in the "list view" and it has a truncate marker | ||
const truncatedPost = !isBlogPostPage && hasTruncateMarker | ||
|
||
const tagsExists = tags.length > 0 | ||
|
||
const renderFooter = tagsExists || truncatedPost || editUrl | ||
|
||
if (!renderFooter) { | ||
return null | ||
} | ||
|
||
// BlogPost footer - details view | ||
if (isBlogPostPage) { | ||
const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy) | ||
|
||
return ( | ||
<footer className="docusaurus-mt-lg"> | ||
{tagsExists && ( | ||
<div className={clsx("row", "margin-top--sm", ThemeClassNames.blog.blogFooterEditMetaRow)}> | ||
<div className="col"> | ||
<TagsListInline tags={tags} /> | ||
</div> | ||
</div> | ||
)} | ||
{canDisplayEditMetaRow && ( | ||
<EditMetaRow | ||
className={clsx("margin-top--sm", ThemeClassNames.blog.blogFooterEditMetaRow)} | ||
editUrl={editUrl} | ||
lastUpdatedAt={lastUpdatedAt} | ||
lastUpdatedBy={lastUpdatedBy} | ||
/> | ||
)} | ||
</footer> | ||
) | ||
} | ||
// BlogPost footer - list view | ||
else { | ||
return ( | ||
<footer className="row docusaurus-mt-lg"> | ||
{tagsExists && ( | ||
<div className={clsx("col", {"col--9": truncatedPost})}> | ||
<TagsListInline tags={tags} /> | ||
</div> | ||
)} | ||
{truncatedPost && ( | ||
<div | ||
className={clsx("col text--right", { | ||
"col--3": tagsExists, | ||
})} | ||
> | ||
<ReadMoreLink blogPostTitle={title} to={metadata.permalink} /> | ||
</div> | ||
)} | ||
</footer> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from "react" | ||
import clsx from "clsx" | ||
import Link, {type Props as LinkProps} from "@docusaurus/Link" | ||
|
||
import type {Props} from "@theme/BlogPostItem/Header/Author" | ||
|
||
function MaybeLink(props: LinkProps): JSX.Element { | ||
if (props.href) { | ||
return <Link {...props} /> | ||
} | ||
return <>{props.children}</> | ||
} | ||
|
||
export default function BlogPostItemHeaderAuthor({author, className}: Props): JSX.Element { | ||
const {name, title, url, imageURL, email} = author | ||
const link = url || (email && `mailto:${email}`) || undefined | ||
return ( | ||
<div className={clsx("avatar margin-bottom--sm", className)}> | ||
{imageURL && ( | ||
<MaybeLink href={link} className="avatar__photo-link"> | ||
<img className="avatar__photo" src={imageURL} alt={name} /> | ||
</MaybeLink> | ||
)} | ||
|
||
{name && ( | ||
<div className="avatar__intro"> | ||
<div className="avatar__name"> | ||
<MaybeLink href={link}> | ||
<span>{name}</span> | ||
</MaybeLink> | ||
</div> | ||
{title && <small className="avatar__subtitle">{title}</small>} | ||
</div> | ||
)} | ||
</div> | ||
) | ||
} |
Oops, something went wrong.