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