rizaldy.club/quartz/components/ArticleTitle.tsx

19 lines
499 B
TypeScript
Raw Normal View History

2023-06-12 13:46:38 +07:00
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
2023-06-10 13:06:02 +07:00
2023-06-12 13:46:38 +07:00
function ArticleTitle({ fileData }: QuartzComponentProps) {
2023-06-10 13:06:02 +07:00
const title = fileData.frontmatter?.title
const displayTitle = fileData.slug === "index" ? undefined : title
if (displayTitle) {
2023-06-19 00:47:07 +07:00
return <h1 class="article-title">{displayTitle}</h1>
2023-06-10 13:06:02 +07:00
} else {
return null
}
}
2023-06-19 00:47:07 +07:00
ArticleTitle.css = `
.article-title {
margin: 2rem 0 0 0;
}
`
2023-06-12 13:46:38 +07:00
export default (() => ArticleTitle) satisfies QuartzComponentConstructor