From 232944a164e367339a74bfebae3d463d77e99ddb Mon Sep 17 00:00:00 2001 From: vanadium23 Date: Sat, 30 Nov 2024 22:56:03 +0300 Subject: [PATCH] feat(layout): fix for review comments * aside --> section * header --> header + pageHeader --- quartz.layout.ts | 2 ++ quartz/cfg.ts | 3 ++- quartz/components/Body.tsx | 2 +- quartz/components/Header.tsx | 3 +-- quartz/components/renderPage.tsx | 19 +++++++++++++------ quartz/plugins/emitters/404.tsx | 1 + quartz/styles/base.scss | 14 +++----------- quartz/styles/variables.scss | 6 +++--- 8 files changed, 26 insertions(+), 24 deletions(-) diff --git a/quartz.layout.ts b/quartz.layout.ts index 4a78256aabda3..a1828a9c69a20 100644 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -16,6 +16,7 @@ export const sharedPageComponents: SharedLayout = { // components for pages that display a single page (e.g. a single note) export const defaultContentPageLayout: PageLayout = { + pageHeader: [], beforeBody: [ Component.Breadcrumbs(), Component.ArticleTitle(), @@ -38,6 +39,7 @@ export const defaultContentPageLayout: PageLayout = { // components for pages that display lists of pages (e.g. tags or folders) export const defaultListPageLayout: PageLayout = { + pageHeader: [], beforeBody: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()], left: [ Component.PageTitle(), diff --git a/quartz/cfg.ts b/quartz/cfg.ts index 135f584994a6d..97a195b39ba37 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -85,6 +85,7 @@ export interface QuartzConfig { export interface FullPageLayout { head: QuartzComponent header: QuartzComponent[] + pageHeader: QuartzComponent[] beforeBody: QuartzComponent[] pageBody: QuartzComponent afterBody: QuartzComponent[] @@ -93,5 +94,5 @@ export interface FullPageLayout { footer: QuartzComponent } -export type PageLayout = Pick +export type PageLayout = Pick export type SharedLayout = Pick diff --git a/quartz/components/Body.tsx b/quartz/components/Body.tsx index 96b6278831c86..b2060f8ed9b1a 100644 --- a/quartz/components/Body.tsx +++ b/quartz/components/Body.tsx @@ -4,7 +4,7 @@ import clipboardStyle from "./styles/clipboard.scss" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" const Body: QuartzComponent = ({ children }: QuartzComponentProps) => { - return
{children}
+ return
{children}
} Body.afterDOMLoaded = clipboardScript diff --git a/quartz/components/Header.tsx b/quartz/components/Header.tsx index 97f091de7e8df..dbf890f8e486a 100644 --- a/quartz/components/Header.tsx +++ b/quartz/components/Header.tsx @@ -1,7 +1,7 @@ import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" const Header: QuartzComponent = ({ children }: QuartzComponentProps) => { - return children.length > 0 ?
{children}
:
+ return children.length > 0 ?
{children}
: null; } Header.css = ` @@ -9,7 +9,6 @@ header { display: flex; flex-direction: row; align-items: center; - justify-content: flex-end; padding: 1rem 2rem; gap: 1.5rem; } diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index d1354314e3a4d..a28fe11dcb35e 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -12,6 +12,7 @@ import { i18n } from "../i18n" interface RenderComponents { head: QuartzComponent header: QuartzComponent[] + pageHeader: QuartzComponent[] beforeBody: QuartzComponent[] pageBody: QuartzComponent afterBody: QuartzComponent[] @@ -191,6 +192,7 @@ export function renderPage( const { head: Head, header, + pageHeader, beforeBody, pageBody: Content, afterBody, @@ -202,19 +204,19 @@ export function renderPage( const Body = BodyConstructor() const LeftComponent = ( - + ) const RightComponent = ( - + ) const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en" @@ -230,8 +232,13 @@ export function renderPage( {LeftComponent} -
+
+ {RightComponent}