Skip to content

Commit

Permalink
components: make Header as header
Browse files Browse the repository at this point in the history
  • Loading branch information
vanadium23 committed Nov 29, 2024
1 parent e1d754e commit 920fd4e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
5 changes: 3 additions & 2 deletions quartz/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"

const Header: QuartzComponent = ({ children }: QuartzComponentProps) => {
return children.length > 0 ? <header>{children}</header> : null
return children.length > 0 ? <header>{children}</header> : <header className={"empty"}></header>
}

Header.css = `
header {
display: flex;
flex-direction: row;
align-items: center;
margin: 2rem 0;
justify-content: flex-end;
padding: 1rem 2rem;
gap: 1.5rem;
}
Expand Down
10 changes: 5 additions & 5 deletions quartz/components/renderPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ export function renderPage(
<Head {...componentData} />
<body data-slug={slug}>
<div id="quartz-root" class="page">
<Header {...componentData}>
{header.map((HeaderComponent) => (
<HeaderComponent {...componentData} />
))}
</Header>
<Body {...componentData}>
{LeftComponent}
<div class="center">
<div class="page-header">
<Header {...componentData}>
{header.map((HeaderComponent) => (
<HeaderComponent {...componentData} />
))}
</Header>
<div class="popover-hint">
{beforeBody.map((BodyComponent) => (
<BodyComponent {...componentData} />
Expand Down
15 changes: 12 additions & 3 deletions quartz/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ a {
.page {
max-width: calc(#{map-get($breakpoints, desktop)} + 300px);
margin: 0 auto;
& header {
margin-top: 1rem;
margin-bottom: 1rem;
&.empty {
margin-top: 0;
margin-bottom: $topSpacing;
}
}

& article {
& > h1 {
font-size: 2rem;
Expand Down Expand Up @@ -182,7 +191,7 @@ a {
gap: 2rem;
top: 0;
box-sizing: border-box;
padding: $topSpacing 2rem 2rem 2rem;
padding: 0 2rem 2rem 2rem;
display: flex;
height: 100vh;
position: sticky;
Expand Down Expand Up @@ -232,8 +241,8 @@ a {
}

& .page-header {
grid-area: grid-header;
margin: $topSpacing 0 0 0;
grid-area: grid-before-body;
margin: 0 0 0 0;
@media all and ($mobile) {
margin-top: 0;
padding: 0;
Expand Down
6 changes: 3 additions & 3 deletions quartz/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $mobileGrid: (
columnGap: "5px",
templateAreas:
'"grid-sidebar-left"\
"grid-header"\
"grid-before-body"\
"grid-center"\
"grid-sidebar-right"\
"grid-footer"',
Expand All @@ -39,7 +39,7 @@ $tabletGrid: (
rowGap: "5px",
columnGap: "5px",
templateAreas:
'"grid-sidebar-left grid-header"\
'"grid-sidebar-left grid-before-body"\
"grid-sidebar-left grid-center"\
"grid-sidebar-left grid-sidebar-right"\
"grid-sidebar-left grid-footer"',
Expand All @@ -50,7 +50,7 @@ $desktopGrid: (
rowGap: "5px",
columnGap: "5px",
templateAreas:
'"grid-sidebar-left grid-header grid-sidebar-right"\
'"grid-sidebar-left grid-before-body grid-sidebar-right"\
"grid-sidebar-left grid-center grid-sidebar-right"\
"grid-sidebar-left grid-footer grid-sidebar-right"',
);

0 comments on commit 920fd4e

Please sign in to comment.