Skip to content

Commit 97743e9

Browse files
navbar layout reference added and Navbarcomponent added before the Header Component
1 parent fd472ae commit 97743e9

File tree

5 files changed

+42
-15
lines changed

5 files changed

+42
-15
lines changed

quartz/components/renderPage.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { QuartzPluginData } from "../plugins/vfile"
1515

1616
interface RenderComponents {
1717
head: QuartzComponent
18+
navbar: QuartzComponent[]
1819
header: QuartzComponent[]
1920
beforeBody: QuartzComponent[]
2021
pageBody: QuartzComponent
@@ -34,12 +35,7 @@ export function pageResources(
3435
const contentIndexScript = `const fetchData = fetch("${contentIndexPath}").then(data => data.json())`
3536

3637
const resources: StaticResources = {
37-
css: [
38-
{
39-
content: joinSegments(baseDir, "index.css"),
40-
},
41-
...staticResources.css,
42-
],
38+
css: [{ content: joinSegments(baseDir, "index.css") }, ...staticResources.css],
4339
js: [
4440
{
4541
src: joinSegments(baseDir, "prescript.js"),
@@ -107,12 +103,7 @@ export function renderPage(
107103
let blockNode = page.blocks?.[blockRef]
108104
if (blockNode) {
109105
if (blockNode.tagName === "li") {
110-
blockNode = {
111-
type: "element",
112-
tagName: "ul",
113-
properties: {},
114-
children: [blockNode],
115-
}
106+
blockNode = { type: "element", tagName: "ul", properties: {}, children: [blockNode] }
116107
}
117108

118109
node.children = [
@@ -210,6 +201,7 @@ export function renderPage(
210201
const {
211202
head: Head,
212203
header,
204+
navbar,
213205
beforeBody,
214206
pageBody: Content,
215207
afterBody,
@@ -228,6 +220,16 @@ export function renderPage(
228220
</div>
229221
)
230222

223+
const NavbarComponent = (
224+
<div class="navbar">
225+
<div class="navbar-center">
226+
{navbar.map((BodyComponent) => (
227+
<BodyComponent {...componentData} />
228+
))}
229+
</div>
230+
</div>
231+
)
232+
231233
const RightComponent = (
232234
<div class="right sidebar">
233235
{right.map((BodyComponent) => (
@@ -238,11 +240,12 @@ export function renderPage(
238240

239241
const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en"
240242
const doc = (
241-
<html lang={lang}>
243+
<html lang={lang} saved-theme="dark">
242244
<Head {...componentData} />
243245
<body data-slug={slug}>
244246
<div id="quartz-root" class="page">
245247
<Body {...componentData}>
248+
{NavbarComponent}
246249
{LeftComponent}
247250
<div class="center">
248251
<div class="page-header">

quartz/components/styles/footer.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ footer {
1111
flex-direction: row;
1212
gap: 1rem;
1313
margin-top: -1rem;
14+
justify-content: center;
1415
}
1516
}

quartz/plugins/emitters/contentPage.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,17 @@ export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOp
5959
...userOpts,
6060
}
6161

62-
const { head: Head, header, beforeBody, pageBody, afterBody, left, right, footer: Footer } = opts
62+
const {
63+
head: Head,
64+
header,
65+
navbar,
66+
beforeBody,
67+
pageBody,
68+
afterBody,
69+
left,
70+
right,
71+
footer: Footer,
72+
} = opts
6373
const Header = HeaderConstructor()
6474
const Body = BodyConstructor()
6575

@@ -69,6 +79,7 @@ export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOp
6979
return [
7080
Head,
7181
Header,
82+
...navbar,
7283
Body,
7384
...header,
7485
...beforeBody,

quartz/styles/base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ a {
203203
height: unset;
204204
flex-direction: row;
205205
padding: 0;
206-
padding-top: 2rem;
206+
padding-top: 6rem;
207207
}
208208
}
209209

quartz/styles/custom.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
@use "./base.scss";
2+
@import "../components/styles/navbar.scss";
23

34
// put your custom CSS here!
5+
.header {
6+
margin: 0.5rem 0;
7+
}
8+
9+
ul.overflow > li:last-of-type {
10+
margin-bottom: 0;
11+
}
12+
13+
.article-title {
14+
margin: 1rem 0 0;
15+
}

0 commit comments

Comments
 (0)