Skip to content

Commit 641df34

Browse files
committed
Blog: only posts put the title on its own row, with twice the gap above the date; /blog/ and the docs keep the buttons on the title row
1 parent 7a98d98 commit 641df34

3 files changed

Lines changed: 48 additions & 15 deletions

File tree

‎frontend/src/pages/DocsPage.tsx‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ function CopyPage({ href }: { href: string }) {
6767
export function DocsPage({ page }: { page: DocsPageData }) {
6868
const current = page.nav.flatMap((s) => s.pages).find((p) => p.slug === page.slug)
6969
const markdown = page.markdown ?? docsMarkdownPath(page.slug)
70+
const actions = (
71+
<div className="docs-actions">
72+
<a className="btn btn-sm" href={markdown}>
73+
<FileTextIcon size={15} aria-hidden /> View as Markdown
74+
</a>
75+
<CopyPage href={markdown} />
76+
</div>
77+
)
7078
const standalone = page.nav.length === 0
7179
return (
7280
<div className="landing docs">
@@ -110,18 +118,22 @@ export function DocsPage({ page }: { page: DocsPageData }) {
110118
)}
111119
<main className="docs-main">
112120
<article className="docs-content">
113-
<header className="docs-head">
114-
<h1>{page.title}</h1>
115-
<div className="docs-head-row">
116-
{page.meta && <p className="blog-meta" dangerouslySetInnerHTML={{ __html: page.meta }} />}
117-
<div className="docs-actions">
118-
<a className="btn btn-sm" href={markdown}>
119-
<FileTextIcon size={15} aria-hidden /> View as Markdown
120-
</a>
121-
<CopyPage href={markdown} />
121+
{/* A blog post has its title on a row of its own, then its date and author beside the buttons. Every other
122+
page has the buttons on the title row. */}
123+
{page.meta ? (
124+
<header className="docs-head docs-head-post">
125+
<h1>{page.title}</h1>
126+
<div className="docs-head-row">
127+
<p className="blog-meta" dangerouslySetInnerHTML={{ __html: page.meta }} />
128+
{actions}
122129
</div>
123-
</div>
124-
</header>
130+
</header>
131+
) : (
132+
<header className="docs-head">
133+
<h1>{page.title}</h1>
134+
{actions}
135+
</header>
136+
)}
125137
<div dangerouslySetInnerHTML={{ __html: page.html }} />
126138
</article>
127139
</main>

‎frontend/src/styles.css‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4251,11 +4251,27 @@ svg.regions-dim {
42514251
Copy page on the right. On a phone the buttons wrap below the date and author. */
42524252
.docs-head {
42534253
display: flex;
4254-
flex-direction: column;
4255-
gap: var(--space-3);
4254+
align-items: center;
4255+
justify-content: space-between;
4256+
gap: var(--space-4);
42564257
margin-bottom: var(--space-8);
42574258
}
42584259

4260+
@media (max-width: 640px) {
4261+
.docs-head {
4262+
flex-direction: column;
4263+
align-items: flex-start;
4264+
}
4265+
}
4266+
4267+
/* A blog post: the title on its own row, then the date and author with the buttons on the right. */
4268+
.docs-head-post {
4269+
flex-direction: column;
4270+
align-items: stretch;
4271+
justify-content: flex-start;
4272+
gap: var(--space-6);
4273+
}
4274+
42594275
.docs-head-row {
42604276
display: flex;
42614277
flex-wrap: wrap;
@@ -4272,11 +4288,14 @@ svg.regions-dim {
42724288
display: flex;
42734289
flex: none;
42744290
gap: var(--space-2);
4291+
}
4292+
4293+
.docs-head-row .docs-actions {
42754294
margin-left: auto;
42764295
}
42774296

42784297
@media (max-width: 640px) {
4279-
.docs-actions {
4298+
.docs-head-row .docs-actions {
42804299
margin-left: 0;
42814300
}
42824301
}

‎scripts/screenshots/pages.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export function pages() {
2626
return bothThemes([
2727
['landing', '/', false, ALL],
2828
['docs/index', '/docs/', false, ALL],
29-
// The blog's list (newest first: the order Nathan checks) and a post, whose header the docs pages share.
29+
['docs/page', '/docs/quick-start/', false, ALL],
30+
// The blog's list (newest first: the order Nathan checks) and a post. Only a post has its title on a row of its
31+
// own; the list and the docs keep the buttons on the title row.
3032
['blog/index', '/blog/', false, ALL],
3133
['blog/post', '/blog/weasyprint-case-study/', false, ALL],
3234
['app/orgs', '/', true, ALL],

0 commit comments

Comments
 (0)