keroosha.cybergulag.today/quartz/components/ArticleTitle.tsx

14 lines
413 B
TypeScript
Raw Normal View History

2023-06-12 09:46:38 +03:00
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
2023-06-10 09:06:02 +03:00
2023-06-12 09:46:38 +03:00
function ArticleTitle({ fileData }: QuartzComponentProps) {
2023-06-10 09:06:02 +03:00
const title = fileData.frontmatter?.title
const displayTitle = fileData.slug === "index" ? undefined : title
if (displayTitle) {
return <h1>{displayTitle}</h1>
} else {
return null
}
}
2023-06-12 09:46:38 +03:00
export default (() => ArticleTitle) satisfies QuartzComponentConstructor