Migrate onto the Moderne design system and rework the header - #538
Draft
zieka wants to merge 2 commits into
Draft
Conversation
…eader Depend on @moderneinc/design-system-tokens@7.3.0 and bridge Infima's --ifm-* variables onto its --mod-* tokens, replacing 48 colour literals. Rework the header into the two-row layout docs.moderne.io uses — navbar above a section nav — and scope the sidebar to the selected section. Colours baked inside data-URI SVGs cannot take a CSS variable, so the carets, breadcrumb separator, pagination arrows and footer mark are redrawn as mask-image, which let three hand-written dark-mode overrides be deleted. The header's height is measured rather than declared: the announcement bar wraps on mobile, so any constant is wrong there. Claude-Session: https://claude.ai/code/session_019z4aUYg8gVhnMY8vStEdia
Raise the navbar to 72px so the logo clears the announcement bar by 20px rather than 12px. Pin card-hover text to --mod-ink-800. The mint hover ground is identical in both themes, so text following the colour mode went near-white on green in dark mode — 1.11:1, unreadable. Pinned it is 11.96:1, matching how the announcement bar already handles the same ground. Claude-Session: https://claude.ai/code/session_019z4aUYg8gVhnMY8vStEdia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
docs.openrewrite.orgshares a Docusaurus ancestor withdocs.moderne.iobut never moved onto the design system, so the two sites have drifted apart visually while still carrying each other's leftovers (this repo'scustom.cssandmoderne-docs' both still declare the same Beausite@font-faceand mint#85FE99).Objectives
@moderneinc/design-system-tokensinstead of literals.docs.moderne.iouses, with the sidebar scoped to the selected section.Assumptions
@moderneinc/design-system-tokens@7.3.0is public on npm and installs without auth, so this repo's public CI can build it. Pinned exact; the installedmoderne.cssis byte-identical to the publishedlatest.moderne.cssis imported whole rather than per-module. Importing only the four files currently used is ~33% smaller, but a token added later would resolve to nothing with no error — worth 7KB gzip to avoid.#85FE99has no semantic token. It exists in the palette only as a raw entry, and consuming raw palette entries is the misuse the system warns about, so it stays a brand literal — asdocs.moderne.ioalso keeps it.docs.moderne.iosplits it the same way.--ifm-navbar-heightis 56px, not the 37px upstream uses: this site's logo is 33px and its search field 38px, against a smaller lockup there.useWindowSize()is the supported way to tell the desktop and mobile sidebars apart — both render throughDocSidebarItemsat level 1.navSections.tshrefs must match generated-index slugs insidebars.ts. Nothing checks this at build time; a mismatch falls back to the full sidebar rather than failing.Changes
(1)package.json,docusaurus.config.ts— add the tokens dependency;customCssloadsmoderne.cssthencustom.css; swap the Inter webfont for Geist + Geist Mono.(1)src/css/custom.css— Infima bridge mapping--ifm-*onto--mod-*. 48 colour literals become 5.(1)src/components/button.module.css,src/theme/DocCard/styles.module.css— onto--mod-button-primary-*and text/border/shadow tokens.(1)src/css/custom.css— admonitions take the mode-aware--mod-color-feedback-*tints and the reference's rounded hairline treatment, replacing Infima's coloured left stripe.(2)src/css/custom.css— sidebar carets, breadcrumb separator, pagination arrows and the footer mark redrawn asmask-image; the SVG supplies the shape, a token the colour. Deletes 3 dark-mode overrides and one duplicated 1.4KB path.(3)src/theme/Navbar/Layout/*— fixed wrapper holding announcement bar, navbar and section nav as one block.(3)src/theme/Navbar/Content/*— three zones: logo left, search and colour-mode toggle centred, external links right.(3)src/components/SecondaryNav/*,src/config/navSections.ts— the section bar; six sections left, three behind aMoredropdown mirroring upstream's right-alignedReleases.(3)src/theme/DocSidebarItems/*— scopes the sidebar to the active section, headed by its name. Desktop only.(4)src/theme/Navbar/Layout/index.tsx— aResizeObserverpublishes the header's measured height as--docs-header-height; the CSS value is a first-paint default only.(5)src/css/custom.css— mint kept as--ifm-color-mintfor the announcement bar, card hover and dark-mode active section.No tests: this repo has no test framework or test files, and this PR adds no testable logic.
tscand the production build are the available checks.Notes
--mod-ink-800(defined only in the package's:root, never its dark block) it is 11.96:1.autothere and its copy wraps to ~3 lines against a 30px reserve, hiding content under the fixed header. Measuring is correct at any width and makes a third row a zero-CSS change.@font-facewent too. The doch1is 36px Geist, matchingdocs.moderne.io.--mod-color-text-warningis a different colour with a different meaning), andgap: 15pxinbutton.module.css(14 and 16 bracket it on the scale). A near-miss substituted silently is worse than a literal left in place.semanticTypographytops out at 28px so there is no display size for a docsh1; package shadows have no dark variant, though--mod-color-surface-shadow-neutralsupplies the mode-aware colour.SearchBarinstances mounted below 997px, soCmd+Kfired twice; and the header reserve above. Also reused@theme/Icon/ExternalLinkand@theme/Navbar/MobileSidebar/Togglerather than the reimplementations first written, restoring the translated "(opens in new tab)" label and thetouchstart/focusindismissal the theme's dropdown uses.yarn typecheckclean; production build succeeds; all 43--mod-*/--docs-*references resolve in the built CSS with none dangling; light and dark checked in-browser; 23 contrast pairings pass AA for normal text in both themes, worst 5.39.<p>minifier warnings come from<ReactPlayer>inline in markdown (no.mdfile is touched here). Separately,yarn typecheckOOMs locally if you build first —tsconfig.jsonsetsallowJs: truewith noexclude, sotscwalks 1.3GB ofbuild/. CI is unaffected (typecheck runs before build); a one-lineexcludewould fix it.https://claude.ai/code/session_019z4aUYg8gVhnMY8vStEdia