Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions frontend/src/pages/DocsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ function CopyPage({ href }: { href: string }) {
export function DocsPage({ page }: { page: DocsPageData }) {
const current = page.nav.flatMap((s) => s.pages).find((p) => p.slug === page.slug)
const markdown = page.markdown ?? docsMarkdownPath(page.slug)
const actions = (
<div className="docs-actions">
<a className="btn btn-sm" href={markdown}>
<FileTextIcon size={15} aria-hidden /> View as Markdown
</a>
<CopyPage href={markdown} />
</div>
)
const standalone = page.nav.length === 0
return (
<div className="landing docs">
Expand Down Expand Up @@ -110,18 +118,22 @@ export function DocsPage({ page }: { page: DocsPageData }) {
)}
<main className="docs-main">
<article className="docs-content">
<header className="docs-head">
<h1>{page.title}</h1>
<div className="docs-head-row">
{page.meta && <p className="blog-meta" dangerouslySetInnerHTML={{ __html: page.meta }} />}
<div className="docs-actions">
<a className="btn btn-sm" href={markdown}>
<FileTextIcon size={15} aria-hidden /> View as Markdown
</a>
<CopyPage href={markdown} />
{/* A blog post has its title on a row of its own, then its date and author beside the buttons. Every other
page has the buttons on the title row. */}
{page.meta ? (
<header className="docs-head docs-head-post">
<h1>{page.title}</h1>
<div className="docs-head-row">
<p className="blog-meta" dangerouslySetInnerHTML={{ __html: page.meta }} />
{actions}
</div>
</div>
</header>
</header>
) : (
<header className="docs-head">
<h1>{page.title}</h1>
{actions}
</header>
)}
<div dangerouslySetInnerHTML={{ __html: page.html }} />
</article>
</main>
Expand Down
25 changes: 22 additions & 3 deletions frontend/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4251,11 +4251,27 @@ svg.regions-dim {
Copy page on the right. On a phone the buttons wrap below the date and author. */
.docs-head {
display: flex;
flex-direction: column;
gap: var(--space-3);
align-items: center;
justify-content: space-between;
gap: var(--space-4);
margin-bottom: var(--space-8);
}

@media (max-width: 640px) {
.docs-head {
flex-direction: column;
align-items: flex-start;
}
}

/* A blog post: the title on its own row, then the date and author with the buttons on the right. */
.docs-head-post {
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
gap: var(--space-6);
}

.docs-head-row {
display: flex;
flex-wrap: wrap;
Expand All @@ -4272,11 +4288,14 @@ svg.regions-dim {
display: flex;
flex: none;
gap: var(--space-2);
}

.docs-head-row .docs-actions {
margin-left: auto;
}

@media (max-width: 640px) {
.docs-actions {
.docs-head-row .docs-actions {
margin-left: 0;
}
}
Expand Down
4 changes: 3 additions & 1 deletion scripts/screenshots/pages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export function pages() {
return bothThemes([
['landing', '/', false, ALL],
['docs/index', '/docs/', false, ALL],
// The blog's list (newest first: the order Nathan checks) and a post, whose header the docs pages share.
['docs/page', '/docs/quick-start/', false, ALL],
// The blog's list (newest first: the order Nathan checks) and a post. Only a post has its title on a row of its
// own; the list and the docs keep the buttons on the title row.
['blog/index', '/blog/', false, ALL],
['blog/post', '/blog/weasyprint-case-study/', false, ALL],
['app/orgs', '/', true, ALL],
Expand Down
Loading