Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions documentation/src/components/blog/blog-post-page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const BlogPostPageView = ({ children }) => {
frontMatter,
tags,
description,
authors,
} = metadata;

const image = frontMatter?.image;
Expand Down Expand Up @@ -72,6 +73,7 @@ export const BlogPostPageView = ({ children }) => {
readingTime={readingTime}
category={category}
tags={tags}
authors={authors ?? []}
shareUrl={shareUrl}
description={description}
siteUrl={siteUrl}
Expand Down Expand Up @@ -250,6 +252,7 @@ const PostHeader = ({
readingTime,
category,
tags,
authors,
shareUrl,
description,
siteUrl,
Expand Down Expand Up @@ -296,7 +299,11 @@ const PostHeader = ({
"gap-4",
)}
>
<PostCategoryAndTags category={category} tags={tags} />
<PostCategoryAndTags
category={category}
tags={tags}
authors={authors}
/>
<ShareActions
shareUrl={shareUrl}
title={title}
Expand Down Expand Up @@ -375,8 +382,9 @@ const PostDateAndReading = ({ date, formattedDate, readingTime }) => {
);
};

const PostCategoryAndTags = ({ category, tags = [] }) => {
const PostCategoryAndTags = ({ category, tags = [], authors = [] }) => {
const { label: categoryLabel, permalink: categoryLink } = category;
const author = authors[0];

return (
<div
Expand Down Expand Up @@ -409,6 +417,35 @@ const PostCategoryAndTags = ({ category, tags = [] }) => {
>
{categoryLabel}
</Link>
{author && (
<>
<span
className={clsx(
"h-1.5",
"w-1.5",
"rounded-full",
"bg-zinc-300",
"dark:bg-zinc-600",
)}
/>
<Link
to={`/blog/author/${author.key}/`}
className={clsx(
"text-zinc-500",
"dark:text-zinc-400",
"no-underline",
"hover:no-underline",
"transition-colors",
"duration-200",
"ease-in-out",
"hover:text-zinc-900",
"dark:hover:text-white",
)}
>
{author.name}
</Link>
</>
)}

{/* {tags.map((tag, index) => {
const label = typeof tag === "string" ? tag : tag?.label;
Expand Down
51 changes: 38 additions & 13 deletions documentation/src/theme/BlogPostItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ import BlogPostItemContainer from "@theme/BlogPostItem/Container";
import { Date as DateComponent } from "@site/src/components/blog/common";
import clsx from "clsx";

const Dot = () => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={6}
height={6}
viewBox="0 0 6 6"
fill="none"
className={clsx("flex-shrink-0", "text-zinc-300 dark:text-zinc-600")}
>
<circle cx={3} cy={3} r={3} fill="currentColor" />
</svg>
);

export default function BlogPostItem({ className }) {
const { metadata } = useBlogPost();
const {
Expand All @@ -16,8 +29,10 @@ export default function BlogPostItem({ className }) {
frontMatter,
description,
category,
authors,
} = metadata;
const { label: categoryLabel, permalink: categoryPermalink } = category;
const author = authors?.[0];

return (
<BlogPostItemContainer className={className}>
Expand Down Expand Up @@ -91,19 +106,29 @@ export default function BlogPostItem({ className }) {
>
{categoryLabel}
</Link>
<svg
xmlns="http://www.w3.org/2000/svg"
width={6}
height={6}
viewBox="0 0 6 6"
fill="none"
className={clsx(
"flex-shrink-0",
"text-zinc-300 dark:text-zinc-600",
)}
>
<circle cx={3} cy={3} r={3} fill="currentColor" />
</svg>
{author && (
<>
<Dot />
<Link
to={`/blog/author/${author.key}/`}
className={clsx(
"uppercase",
"no-underline",
"hover:no-underline",
"text-zinc-500",
"dark:text-zinc-400",
"hover:text-zinc-600",
"dark:hover:text-zinc-300",
"transition-colors",
"duration-200",
"ease-in-out",
)}
>
{author.name}
</Link>
</>
)}
<Dot />
<DateComponent date={date} formattedDate={formattedDate} />
</div>
<div>
Expand Down