From 906f91f8eed5e91a7afae95c7002a3e4553d6aae Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 13 Jul 2023 07:19:35 +0000
Subject: [PATCH] base path refactor, more docs
---
quartz/components/PageTitle.tsx | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/quartz/components/PageTitle.tsx b/quartz/components/PageTitle.tsx
index 080b74d..ea1248f 100644
--- a/quartz/components/PageTitle.tsx
+++ b/quartz/components/PageTitle.tsx
@@ -1,9 +1,17 @@
-import { resolveToRoot } from "../path"
-import { QuartzComponentProps } from "./types"
+import { pathToRoot } from "../path"
+import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
-export default function({ cfg, fileData }: QuartzComponentProps) {
- const title = cfg.siteTitle
+function PageTitle({ fileData, cfg }: QuartzComponentProps) {
+ const title = cfg?.pageTitle ?? "Untitled Quartz"
const slug = fileData.slug!
- const baseDir = resolveToRoot(slug)
- return <h1><a href={baseDir}>{title}</a></h1>
+ const baseDir = pathToRoot(slug)
+ return <h1 class="page-title"><a href={baseDir}>{title}</a></h1>
}
+
+PageTitle.css = `
+.page-title {
+ margin: 0;
+}
+`
+
+export default (() => PageTitle) satisfies QuartzComponentConstructor
--
Gitblit v1.10.0