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