-
Notifications
You must be signed in to change notification settings - Fork 23
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
34ad3cf
commit 3dc8c5d
Showing
17 changed files
with
300 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import clsx from "clsx"; | ||
import React from "react"; | ||
|
||
type HeadlineProps = { | ||
children: React.ReactNode; | ||
className?: string; | ||
}; | ||
|
||
export default function Headline({ children, className }: HeadlineProps) { | ||
return ( | ||
<h1 | ||
className={clsx( | ||
"text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold leading-normal lg:leading-normal tracking-wider text-center px-4", | ||
className | ||
)} | ||
> | ||
{children} | ||
</h1> | ||
); | ||
} |
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,44 @@ | ||
import React from "react"; | ||
import Link, { type Props as LinkProps } from "@docusaurus/Link"; | ||
|
||
import type { Props } from "@theme/BlogPostItem/Header/Author"; | ||
|
||
function MaybeLink(props: LinkProps) { | ||
if (props.href) { | ||
return <Link {...props} />; | ||
} | ||
return <>{props.children}</>; | ||
} | ||
|
||
export default function BlogPostItemHeaderAuthor({ author }: Props) { | ||
const { name, title, url, imageURL, email } = author; | ||
const link = url || (email && `mailto:${email}`) || undefined; | ||
return ( | ||
<div className="flex gap-4 items-center shrink-0"> | ||
{imageURL && ( | ||
<MaybeLink href={link}> | ||
<img src={imageURL} alt={name} className="w-14 h-14 rounded-full" /> | ||
</MaybeLink> | ||
)} | ||
|
||
{name && ( | ||
<div | ||
itemProp="author" | ||
itemScope | ||
itemType="https://schema.org/Person" | ||
className="flex flex-col" | ||
> | ||
<MaybeLink href={link} itemProp="url" className="font-bold"> | ||
<span itemProp="name">{name}</span> | ||
</MaybeLink> | ||
|
||
{title && ( | ||
<span itemProp="description" className="text-sm"> | ||
{title} | ||
</span> | ||
)} | ||
</div> | ||
)} | ||
</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,28 @@ | ||
import React from "react"; | ||
import { useBlogPost } from "@docusaurus/theme-common/internal"; | ||
import BlogPostItemHeaderAuthor from "@theme/BlogPostItem/Header/Author"; | ||
|
||
export default function BlogPostItemHeaderAuthors() { | ||
const { | ||
metadata: { authors }, | ||
assets, | ||
} = useBlogPost(); | ||
const authorsCount = authors.length; | ||
if (authorsCount === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="flex gap-6 mt-6 px-4 flex-wrap justify-center"> | ||
{authors.map((author, idx) => ( | ||
<BlogPostItemHeaderAuthor | ||
key={idx} | ||
author={{ | ||
...author, | ||
imageURL: assets.authorsImageUrls[idx] ?? author.imageURL, | ||
}} | ||
/> | ||
))} | ||
</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,25 @@ | ||
import React from "react"; | ||
import BlogPostItemHeaderAuthors from "@theme/BlogPostItem/Header/Authors"; | ||
import Jumbotron from "@site/src/components/Jumbotron"; | ||
import { useBlogPost } from "@docusaurus/theme-common/internal"; | ||
import Headline from "@site/src/components/Headline"; | ||
|
||
export default function BlogPostItemHeader() { | ||
const { metadata } = useBlogPost(); | ||
const { date, formattedDate, title } = metadata; | ||
|
||
return ( | ||
<Jumbotron> | ||
<time | ||
dateTime={date} | ||
itemProp="datePublished" | ||
className="text-purple-400 uppercase font-bold" | ||
> | ||
{formattedDate} | ||
</time> | ||
<Headline>{title}</Headline> | ||
|
||
<BlogPostItemHeaderAuthors /> | ||
</Jumbotron> | ||
); | ||
} |
Oops, something went wrong.