Skip to content

Commit

Permalink
feat(layout): make header outside of center
Browse files Browse the repository at this point in the history
* make header above all content
* make beforeBody --> pageHeader
  • Loading branch information
vanadium23 committed Dec 1, 2024
1 parent 14e9d44 commit b2423a3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 21 deletions.
6 changes: 2 additions & 4 deletions quartz.layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +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: [
pageHeader: [
Component.Breadcrumbs(),
Component.ArticleTitle(),
Component.ContentMeta(),
Expand All @@ -39,8 +38,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()],
pageHeader: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()],
left: [
Component.PageTitle(),
Component.MobileOnly(Component.Spacer()),
Expand Down
3 changes: 1 addition & 2 deletions quartz/cfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ export interface FullPageLayout {
head: QuartzComponent
header: QuartzComponent[]
pageHeader: QuartzComponent[]
beforeBody: QuartzComponent[]
pageBody: QuartzComponent
afterBody: QuartzComponent[]
left: QuartzComponent[]
right: QuartzComponent[]
footer: QuartzComponent
}

export type PageLayout = Pick<FullPageLayout, "pageHeader" | "beforeBody" | "left" | "right">
export type PageLayout = Pick<FullPageLayout, "pageHeader" | "left" | "right">
export type SharedLayout = Pick<FullPageLayout, "head" | "header" | "footer" | "afterBody">
9 changes: 1 addition & 8 deletions quartz/components/renderPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ interface RenderComponents {
head: QuartzComponent
header: QuartzComponent[]
pageHeader: QuartzComponent[]
beforeBody: QuartzComponent[]
pageBody: QuartzComponent
afterBody: QuartzComponent[]
left: QuartzComponent[]
Expand Down Expand Up @@ -193,7 +192,6 @@ export function renderPage(
head: Head,
header,
pageHeader,
beforeBody,
pageBody: Content,
afterBody,
left,
Expand Down Expand Up @@ -234,13 +232,8 @@ export function renderPage(
{LeftComponent}
<section class="center">
<div class="page-header">
<Header {...componentData}>
{pageHeader.map((HeaderComponent) => (
<HeaderComponent {...componentData} />
))}
</Header>
<div class="popover-hint">
{beforeBody.map((BodyComponent) => (
{pageHeader.map((BodyComponent) => (
<BodyComponent {...componentData} />
))}
</div>
Expand Down
1 change: 0 additions & 1 deletion quartz/plugins/emitters/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const NotFoundPage: QuartzEmitterPlugin = () => {
...sharedPageComponents,
pageBody: NotFound(),
pageHeader: [],
beforeBody: [],
left: [],
right: [],
}
Expand Down
4 changes: 2 additions & 2 deletions quartz/plugins/emitters/contentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOp
...userOpts,
}

const { head: Head, header, beforeBody, pageBody, afterBody, left, right, footer: Footer } = opts
const { head: Head, header, pageHeader, pageBody, afterBody, left, right, footer: Footer } = opts
const Header = HeaderConstructor()
const Body = BodyConstructor()

Expand All @@ -71,7 +71,7 @@ export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOp
Header,
Body,
...header,
...beforeBody,
...pageHeader,
pageBody,
...afterBody,
...left,
Expand Down
4 changes: 2 additions & 2 deletions quartz/plugins/emitters/folderPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const FolderPage: QuartzEmitterPlugin<Partial<FolderPageOptions>> = (user
...userOpts,
}

const { head: Head, header, beforeBody, pageBody, afterBody, left, right, footer: Footer } = opts
const { head: Head, header, pageHeader, pageBody, afterBody, left, right, footer: Footer } = opts
const Header = HeaderConstructor()
const Body = BodyConstructor()

Expand All @@ -45,7 +45,7 @@ export const FolderPage: QuartzEmitterPlugin<Partial<FolderPageOptions>> = (user
Header,
Body,
...header,
...beforeBody,
...pageHeader,
pageBody,
...afterBody,
...left,
Expand Down
4 changes: 2 additions & 2 deletions quartz/plugins/emitters/tagPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const TagPage: QuartzEmitterPlugin<Partial<TagPageOptions>> = (userOpts)
...userOpts,
}

const { head: Head, header, beforeBody, pageBody, afterBody, left, right, footer: Footer } = opts
const { head: Head, header, pageHeader, pageBody, afterBody, left, right, footer: Footer } = opts
const Header = HeaderConstructor()
const Body = BodyConstructor()

Expand All @@ -42,7 +42,7 @@ export const TagPage: QuartzEmitterPlugin<Partial<TagPageOptions>> = (userOpts)
Header,
Body,
...header,
...beforeBody,
...pageHeader,
pageBody,
...afterBody,
...left,
Expand Down

0 comments on commit b2423a3

Please sign in to comment.