From 3cc21d9a4c7e979f19a9210b035c01b316dd06a2 Mon Sep 17 00:00:00 2001 From: ChristopherPHolder Date: Sat, 28 Nov 2026 09:38:37 +0100 Subject: [PATCH] docs: the header is the name and three icons on a phone, and the footer sorts its links into lists The header's brand no longer says "docs". Search, the repository on GitHub and the menu are icons of one kind; the menu's three lines cross while it is open, and its name stays "Menu" with aria-expanded saying the rest. Below 360px the repository's icon gives way and stays in the menu. The footer has the name and what the library does, three lists (the docs' sections, the live examples, the project) and who built it. Closes #112 --- apps/docs/src/app/app.ts | 105 ++++++++++++++--- apps/docs/src/styles.css | 245 +++++++++++++++++++++++++++++++++------ 2 files changed, 295 insertions(+), 55 deletions(-) diff --git a/apps/docs/src/app/app.ts b/apps/docs/src/app/app.ts index e9bf955..b346826 100644 --- a/apps/docs/src/app/app.ts +++ b/apps/docs/src/app/app.ts @@ -21,6 +21,7 @@ import { import { filter } from 'rxjs'; // `?no-inline`: Vite would inline an asset this small as a data: URI, which NgOptimizedImage rejects. import logo from '@angular-ssr-stream/press-kit/symbol/angular-ssr-stream-symbol.svg?no-inline'; +import pushBased from '@angular-ssr-stream/design-system/pushbased-logo.svg?no-inline'; import { ALL_PAGES, DOCS, type DocSection } from './docs/nav'; import { DEMO, MOVIES, REPO } from './links'; import { trackPageHead } from './page-head'; @@ -36,24 +37,40 @@ import { DocsSearch } from './search/search'; - angular-ssr-stream docs + angular-ssr-stream - + @@ -95,7 +112,8 @@ import { DocsSearch } from './search/search'; } } - + `, @@ -129,10 +184,26 @@ import { DocsSearch } from './search/search'; }) export class App { protected readonly logo = logo; + protected readonly pushBased = pushBased; protected readonly docs = DOCS; protected readonly demo = DEMO; protected readonly movies = MOVIES; protected readonly repo = REPO; + protected readonly issues = REPO + '/issues'; + + /** + * The footer's way into each section: its first page, or, where the pages + * are alternatives, the choice between them on the home page. The press kit + * is listed with the project. + */ + protected readonly footerSections = DOCS.filter((section) => section.id !== 'about').map( + (section) => { + const first = section.groups[0].pages[0]; + return section.alternatives + ? { title: section.title, link: ['/'], fragment: 'home-' + section.id } + : { title: section.title, link: ['/docs', first.dir, first.slug], fragment: undefined }; + }, + ); /** The sidebar as a menu over the page, below `MENU_BREAKPOINT`. */ protected readonly menuOpen = signal(false); diff --git a/apps/docs/src/styles.css b/apps/docs/src/styles.css index 2bf9b31..2f8f73f 100644 --- a/apps/docs/src/styles.css +++ b/apps/docs/src/styles.css @@ -168,26 +168,63 @@ pre.mermaid { display: block; } -.brand span { - color: var(--color-text-muted); -} - .top-nav { display: flex; + align-items: center; gap: var(--space-6); } -.top-nav a { +.top-link { display: flex; align-items: center; + align-self: stretch; color: var(--color-neutral-600); text-decoration: none; } -.top-nav a:hover { +.top-link:hover { color: var(--color-neutral-900); } +/* + * A control that is its icon alone: the repository, the menu, and on a phone + * the search. 40px wide so three fit next to the brand at 360px, 44px tall + * for a finger. + */ +.icon-btn { + display: inline-flex; + flex: none; + align-items: center; + justify-content: center; + width: var(--space-10); + height: var(--space-11); + padding: 0; + border: 0; + border-radius: var(--radius-lg); + background: none; + color: var(--color-neutral-600); + cursor: pointer; + transition: + background-color 0.2s ease-out, + color 0.2s ease-out; +} + +.icon-btn:hover { + background: var(--color-neutral-100); + color: var(--color-neutral-900); +} + +/* The last icon's edge, not its box's, lines up with the page's. */ +.top-nav .icon-btn, +.menu-toggle { + margin-right: calc(-1 * var(--space-2-5)); +} + +/* Next to the words, as far from them as they are from each other. */ +.top-nav .icon-btn { + margin-left: calc(-1 * var(--space-2-5)); +} + /* Search: the button in the header, and the dialog it opens. */ docs-search { @@ -319,6 +356,33 @@ html:has(.search[open]) { align-self: center; } +/* Three lines, which cross while the menu is open. */ +.menu-icon { + fill: none; + stroke: currentColor; + stroke-width: 1.75; + stroke-linecap: round; +} + +.menu-icon path { + transform-origin: center; + transition: + transform 0.15s ease-out, + opacity 0.15s ease-out; +} + +.menu-toggle[aria-expanded='true'] .menu-icon path:nth-child(1) { + transform: rotate(45deg) translateY(5px); +} + +.menu-toggle[aria-expanded='true'] .menu-icon path:nth-child(2) { + opacity: 0; +} + +.menu-toggle[aria-expanded='true'] .menu-icon path:nth-child(3) { + transform: rotate(-45deg) translateY(-5px); +} + /* Sidebar, then the page. */ .shell { @@ -436,9 +500,9 @@ details[open] > summary.sidebar-title::after { --header-height: 3.5rem; } - /* The brand and the buttons fit a 320px screen with this between them. */ + /* The icons stand side by side: each brings its own space. */ .top-inner { - gap: var(--space-2); + gap: 0; } .search-open kbd { @@ -449,10 +513,20 @@ details[open] > summary.sidebar-title::after { margin-top: var(--space-4); } - .top-nav { + /* While the search still has its word, its box stands off the icons. */ + docs-search { + margin-right: var(--space-2); + } + + /* The words are in the menu; the repository's icon stays. */ + .top-link { display: none; } + .top-nav .icon-btn { + margin-inline: 0; + } + .menu-toggle { display: inline-flex; } @@ -527,9 +601,26 @@ details[open] > summary.sidebar-title::after { border-left: 0; } - /* The magnifier alone; the button keeps its name for a screen reader. */ + docs-search { + margin-right: 0; + } + + /* The magnifier alone, as an .icon-btn; the button keeps its name for a + screen reader. */ .search-open { - padding: var(--space-2-5); + --btn-bg: transparent; + --btn-bg-hover: var(--color-neutral-100); + --btn-border: none; + --btn-shadow: none; + justify-content: center; + width: var(--space-10); + height: var(--space-11); + padding: 0; + } + + .search-open svg { + width: var(--space-5); + height: var(--space-5); } .search-open-label { @@ -543,25 +634,22 @@ details[open] > summary.sidebar-title::after { } } -/* The narrowest phones: the name without "docs", and tighter spacing around - it, leave room for both buttons. */ -@media (max-width: 360px) { +/* The narrowest phones have room for two icons next to the brand: the + repository is in the menu. */ +@media (max-width: 359px) { .brand { gap: var(--space-2); } - .brand span { + .top-nav { display: none; } - - .menu-toggle { - padding-inline: var(--space-2); - } } @media (prefers-reduced-motion: reduce) { .sidebar, - .sidebar--open { + .sidebar--open, + .menu-icon path { transition: none; } } @@ -1705,7 +1793,7 @@ pre.mermaid[data-processed] svg { padding-block: var(--space-1-5); } -/* Footer. */ +/* Footer: what this is, the ways on from here in three lists, and who made it. */ .bottom { border-top: 1px solid var(--color-border); @@ -1716,41 +1804,122 @@ pre.mermaid[data-processed] svg { } .bottom-inner { - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: space-between; - gap: var(--space-3) var(--space-6); - padding-block: var(--space-6); + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); + gap: var(--space-10) var(--space-16); + padding-block: var(--space-12) var(--space-8); } -.bottom p { - margin: 0; +.bottom-about .brand { + display: inline-flex; } -.bottom nav { - display: flex; - flex-wrap: wrap; - gap: var(--space-2) var(--space-5); +.bottom-about p { + max-width: 22rem; + margin: var(--space-3) 0 0; } -.bottom a { +.bottom-nav { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: var(--space-8) var(--space-6); +} + +.bottom-title { + margin: 0 0 var(--space-2); + color: var(--color-text-heading); + font-size: 0.75rem; + line-height: 1rem; +} + +.bottom ul { + list-style: none; + margin: 0; + padding: 0; +} + +.bottom-nav a { + display: inline-block; + padding-block: var(--space-1-5); color: var(--color-neutral-700); + text-decoration: none; } -.bottom a:hover { +.bottom-nav a:hover { color: var(--color-primary-700); + text-decoration: underline; +} + +.bottom-by { + grid-column: 1 / -1; + margin: 0; + padding-top: var(--space-6); + border-top: 1px solid var(--color-neutral-200); +} + +.bottom-by a { + display: inline-flex; + align-items: center; + gap: var(--space-3); + color: inherit; + text-decoration: none; +} + +.bottom-by a:hover { + color: var(--color-neutral-900); +} + +.bottom-by img { + display: block; } @media (max-width: 900px) { - .bottom nav { - row-gap: 0; + .bottom-inner { + grid-template-columns: minmax(0, 1fr); + gap: var(--space-8); + padding-block: var(--space-10) var(--space-6); } - .bottom a { + /* A finger needs more to aim at than a pointer: 44px a link. */ + .bottom-nav a { display: block; padding-block: var(--space-3); } + + .bottom-title { + margin-bottom: 0; + } + + .bottom-by { + padding-top: var(--space-4); + } + + .bottom-by a { + padding-block: var(--space-1-5); + } +} + +/* A phone: the docs down the left, the other two lists down the right. */ +@media (max-width: 560px) { + .bottom-nav { + grid-template-columns: repeat(2, minmax(0, 1fr)); + grid-template-areas: + 'docs live' + 'docs project'; + row-gap: var(--space-6); + } + + .bottom-docs { + grid-area: docs; + } + + .bottom-live { + grid-area: live; + } + + .bottom-project { + grid-area: project; + } } /* Press kit: each version of the logo on the background it is made for. */