quartz-research-note/quartz/components/ArticleTitle.tsx

20 lines
501 B
TypeScript
Raw Normal View History

2023-06-12 06:46:38 +00:00
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
2024-02-05 10:45:36 +00:00
import { classNames } from "../util/lang"
2023-06-10 06:06:02 +00:00
function ArticleTitle({ fileData, displayClass }: QuartzComponentProps) {
2023-06-10 06:06:02 +00:00
const title = fileData.frontmatter?.title
2023-07-02 20:08:29 +00:00
if (title) {
2024-02-05 10:45:36 +00:00
return <h1 class={classNames(displayClass, "article-title")}>{title}</h1>
2023-06-10 06:06:02 +00:00
} else {
return null
}
}
2024-02-05 10:45:36 +00:00
2023-06-18 17:47:07 +00:00
ArticleTitle.css = `
.article-title {
margin: 2rem 0 0 0;
}
`
2023-06-12 06:46:38 +00:00
export default (() => ArticleTitle) satisfies QuartzComponentConstructor