2023-08-20 07:52:25 +09:00
|
|
|
import { pathToRoot } from "../util/path"
|
2023-06-12 15:46:38 +09:00
|
|
|
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
2024-01-30 14:51:13 +09:00
|
|
|
import { classNames } from "../util/lang"
|
2023-06-08 14:27:32 +09:00
|
|
|
|
2023-10-02 09:20:55 +09:00
|
|
|
function PageTitle({ fileData, cfg, displayClass }: QuartzComponentProps) {
|
2023-07-02 05:35:27 +09:00
|
|
|
const title = cfg?.pageTitle ?? "Untitled Quartz"
|
2023-08-20 07:52:25 +09:00
|
|
|
const baseDir = pathToRoot(fileData.slug!)
|
2023-07-23 09:27:41 +09:00
|
|
|
return (
|
2024-01-30 14:51:13 +09:00
|
|
|
<h1 class={classNames(displayClass, "page-title")}>
|
2023-07-23 09:27:41 +09:00
|
|
|
<a href={baseDir}>{title}</a>
|
|
|
|
</h1>
|
|
|
|
)
|
2023-06-08 14:27:32 +09:00
|
|
|
}
|
2023-06-12 15:46:38 +09:00
|
|
|
|
2023-07-02 05:35:27 +09:00
|
|
|
PageTitle.css = `
|
|
|
|
.page-title {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
`
|
2023-06-19 02:47:07 +09:00
|
|
|
|
2023-07-02 05:35:27 +09:00
|
|
|
export default (() => PageTitle) satisfies QuartzComponentConstructor
|