From 626acb4a72c99026a535a5693e1e62c871ade342 Mon Sep 17 00:00:00 2001 From: Heli-o Date: Fri, 5 Apr 2024 19:52:13 +0200 Subject: [PATCH] added a page image component --- quartz.layout.ts | 1 + quartz/components/PageImage.tsx | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 quartz/components/PageImage.tsx diff --git a/quartz.layout.ts b/quartz.layout.ts index 06ee965..b0055a5 100644 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -21,6 +21,7 @@ export const defaultContentPageLayout: PageLayout = { Component.TagList(), ], left: [ + Component.PageImage(), Component.PageTitle(), Component.MobileOnly(Component.Spacer()), Component.Search(), diff --git a/quartz/components/PageImage.tsx b/quartz/components/PageImage.tsx new file mode 100644 index 0000000..ac39683 --- /dev/null +++ b/quartz/components/PageImage.tsx @@ -0,0 +1,20 @@ +import { pathToRoot } from "../util/path" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { classNames } from "../util/lang" +import { i18n } from "../i18n" + +const PageImage: QuartzComponent = ({ fileData, cfg, displayClass }: QuartzComponentProps) => { + const title = cfg?.pageTitle ?? i18n(cfg.locale).propertyDefaults.title + const baseDir = pathToRoot(fileData.slug!) + return ( + + ) +} + +PageImage.css = ` +.page-title { + margin: 0; +} +` + +export default (() => PageImage) satisfies QuartzComponentConstructor