2024-02-14 11:53:44 +07:00
|
|
|
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
2024-01-30 12:51:13 +07:00
|
|
|
import { classNames } from "../util/lang"
|
2023-06-10 13:06:02 +07:00
|
|
|
|
2024-02-14 11:53:44 +07:00
|
|
|
const ArticleTitle: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
|
2023-06-10 13:06:02 +07:00
|
|
|
const title = fileData.frontmatter?.title
|
2023-07-03 03:08:29 +07:00
|
|
|
if (title) {
|
2024-01-30 12:51:13 +07:00
|
|
|
return <h1 class={classNames(displayClass, "article-title")}>{title}</h1>
|
2023-06-10 13:06:02 +07:00
|
|
|
} else {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
2024-02-05 11:57:10 +07:00
|
|
|
|
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
|