24 lines
685 B
TypeScript
Raw Normal View History

import { pathToRoot } from "../util/path"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { classNames } from "../util/lang"
import { i18n } from "../i18n"
2023-06-07 22:27:32 -07:00
const PageTitle: QuartzComponent = ({ fileData, cfg, displayClass }: QuartzComponentProps) => {
const title = cfg?.pageTitle ?? i18n(cfg.locale).propertyDefaults.title
const baseDir = pathToRoot(fileData.slug!)
2023-07-22 17:27:41 -07:00
return (
<h2 class={classNames(displayClass, "page-title")}>
2023-07-22 17:27:41 -07:00
<a href={baseDir}>{title}</a>
</h2>
2023-07-22 17:27:41 -07:00
)
2023-06-07 22:27:32 -07:00
}
2023-06-11 23:46:38 -07:00
2023-07-01 13:35:27 -07:00
PageTitle.css = `
.page-title {
font-size: 1.75rem;
2023-07-01 13:35:27 -07:00
margin: 0;
}
`
2023-06-18 10:47:07 -07:00
2023-07-01 13:35:27 -07:00
export default (() => PageTitle) satisfies QuartzComponentConstructor