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