public_notes/quartz/components/PageTitle.tsx

18 lines
488 B
TypeScript
Raw Normal View History

2023-06-08 14:27:32 +09:00
import { resolveToRoot } from "../path"
2023-06-12 15:46:38 +09:00
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
2023-06-08 14:27:32 +09:00
2023-07-02 05:35:27 +09:00
function PageTitle({ fileData, cfg }: QuartzComponentProps) {
const title = cfg?.pageTitle ?? "Untitled Quartz"
const slug = fileData.slug!
const baseDir = resolveToRoot(slug)
return <h1 class="page-title"><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