Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify and generalize navigation #431

Merged
merged 2 commits into from
Mar 19, 2024
Merged

Simplify and generalize navigation #431

merged 2 commits into from
Mar 19, 2024

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Mar 19, 2024

🛠 Summary of changes

Updates how side navigation is generated within the local documentation site, to avoid tying it specifically to components.

This is part of a series of changes looking to introduce new sections for "Utilities" in addition to components, which will need to have its own side navigation.

📜 Testing Plan

The only meaningful change is that visiting the root URL will redirect automatically to the first component.

  1. npm start
  2. Visit http://localhost:4000/
  3. Observe that you are redirected to http://localhost:4000/accordions/

#
# {{ '/' | resolve_permalink %} => home page
# {{ '/components/foo/' | resolve_permalink %} => from a collection
def resolve_permalink(href)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation is not new, it already existed in the now-removed uswds.rb. This is the only utility from that module we still needed, and the naming "USWDS" was confusing, so I renamed the file and module to reflect the single remaining helper.

@aduth aduth force-pushed the aduth-generic-nav branch from 3cdc81e to d227eb6 Compare March 19, 2024 19:43
Index now redirects immediately to the first component example
@aduth
Copy link
Contributor Author

aduth commented Mar 19, 2024

Visual regression tests caught a change that I wasn't intending, which is that previously the side navigation would "expand" and show sub-headings of a page, e.g. "Button sizes and states" on the Buttons page. This no longer happens. I think I'm fine with this side-effect and we could consider the In-Page Navigation component if we wanted something like this in the future, but good to highlight another instance of the visual regression tests doing their job.

Before After
image image

@aduth aduth merged commit 8d44fa6 into main Mar 19, 2024
3 of 4 checks passed
@aduth aduth deleted the aduth-generic-nav branch March 19, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants