Repository navigation
feat(guidelines): group the page list into foldable sections - #437
Merged
Merged
Conversation
The page list was 24 switches in one column. Every GuidelinePage now has a section (Foundation, Logo, Color, Type, Imagery, UI, Voice or Tokens), and the list shows one foldable group per section with a switch that turns all of its pages on or off. A folded section still shows how many of its pages are on. A section switch writes its pages into the same switched-off list the PDF, the website and the Markdown export already read, so numbering, the contents and the bookmarks follow with no change to the exports. The cover has no switch and stays in the book. The grouping and switching logic is pure and lives in lib/guidelines/sections.ts. The section is a new field on the page, separate from the label drawn in the running header, so the pages look the same as before. Tests cover every page having a section, the book order of the groups, and each section switched off being left out of the PDF bookmarks, the website and the Markdown export.
A page that was switched off was dimmed with opacity, which dropped its title below the 4.5:1 contrast axe requires. The e2e scan only opens the studio with every page on, so it never saw it. A switched-off title now uses the subtle foreground color instead. The section header also shows its count as 3/5 (read out as "3 of 5 pages on"), so section names such as Foundation and Imagery are not cut off in the narrow page list.
Contributor
|
@AnayDhawan is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
yakew7
marked this pull request as ready for review
October 24, 2026 12:03
Owner
|
@AnayDhawan Fix CI Fail |
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.
Summary
The page list in the Brand Guidelines studio was 24 switches in one column. It is now grouped into the eight sections of the book: Foundation, Logo, Color, Type, Imagery, UI, Voice and Tokens.
GuidelinePagehas asection(a new field, typed fromguidelineSectionsinlib/guidelines/types.ts). It is separate from the label each page draws in its running header, so the pages themselves look exactly as before.aria-expandedandaria-controls) and has a switch for the whole section. A folded section still shows how many of its pages are on, as3/5(read out as "3 of 5 pages on").excludedlist the PDF, the website and the Markdown export already read, so numbering, the contents and the PDF bookmarks follow as they do today. The exports needed no change.lib/guidelines/sections.ts. The list is split intoguideline-page-list.tsx(state) andguideline-section-group.tsx(one section).color-contrastbecause it was dimmed withopacity-50. This was already true before this change, and the existing axe scan never sees it because it only opens the studio with every page on. A switched-off title now usestext-subtle-foreground.docs/guidelines-pages.mdexplains thesectionfield and the new test.CHANGELOG.mdhas an entry under Unreleased.Closes #423
Screenshots
Screenshots to be attached: the page list in light and dark at desktop width, and at 375 px, each with every section open and with some sections folded and some pages and a whole section switched off.
What changed visually:
n/totalcount and its own switch on the right, in line with the page switches below it.--instead of a number and a dimmer title that still meets 4.5:1 in both themes.Checklist
pnpm typecheck,pnpm test,pnpm lint,pnpm check:dashesandpnpm buildpassfeat:,fix:,docs:,chore:)any, noconsole.log, no new external services without a note in.env.exampleCHANGELOG.mdupdated if behavior changedBreaking changes
None. The switched-off list in the persisted guidelines store keeps its shape (a list of page ids), so saved projects and stored state open as before.
GuidelinePagehas a new requiredsectionfield, which only matters to code that builds its ownGuidelinePage(all 24 registered pages are updated).Testing completed
Run on Windows with Node 24 and pnpm 11:
pnpm typecheck,pnpm lint(one existing warning inlib/color/matrix.test.ts),pnpm format:checkandpnpm buildpass.pnpm test: 2480 tests pass. The first box above is left unticked because 18 tests inlib/background/merge.test.tsfail on my machine. They compare generated CSS with fixture files, and the fixtures are checked out with CRLF line endings on Windows (core.autocrlf=true). I did not touch that file or its fixtures. I expect CI on Linux to pass but have not seen it run.pnpm check:dashesreports two hits, both inside untrackedpackages/cli/node_modules/vite/distfiles thatpnpm installcreated on my machine. No file in this change has a dash.lib/guidelines/sections.test.ts: every registered page has a known section, the sections come out in order and each page once, a section's pages are one run in book order, grouping and switching on and off (other entries kept, no duplicates, the cover never added), and page numbers follow. For each of the eight sections switched off, the website has no page or art for its pages, the Markdown export has no art and its headings still count 1, 2, 3, and the contents numbering follows. A new test inlib/guidelines/outline.test.tschecks the PDF bookmarks skip a switched-off section. The PDF itself is not rasterized in unit tests (it needs a canvas); it uses the same filtered page list, which is what the tests cover.pnpm starton a production build:tests/e2e/axe.spec.tsfor Brand Guidelines passes in light and dark, and so do the Brand Guidelines route andgshortcut tests. A separate script ran axe in light and dark at 1280 px and 375 px with some sections folded and some pages and one whole section off (no serious or critical violations after the contrast fix), and checked there is no horizontal page scroll at 375 px.--numbers, see later pages renumber, switch one page back on, select a page, and confirm the cover switch stays disabled and Foundation off leaves 1 of 3.