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
Refactor header #982
Refactor header #982
Conversation
3963092
to
d1828fa
Compare
Added a commit to include yarn in the GitHub Actions build as unit tests touching components depend upon it, or at least they do now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 beaut
This component brings together the logic for constructing header navigation for the various parts of the application. Instead of putting links into partials, header navigations are now configured by NavigationItems.for_candidate_interface, .for_provider_interface etc. These methods return lists of NavigationItems which the HeaderComponent knows how to turn into links. This means that no logic about what should be in navigations lives in templates. It exposes some wrinkles about the way we handle eg SupportUsers vs DfE Sign-in users in the same way across Support and Provider interfaces and should make refactoring these easier. This resolves a bug where the dropdown menu was appearing on a screen where it shouldn't, and hopefully prevents that kind of bug in the future. We also get to throw away a lot of repeated markup which risked being brittle.
Bring the rest of the <header> inside HeaderComponent. Add a classes: attr in line with the convention established by govuk-frontend, and use the appropriate HostingEnvironment to set it.
Components need frontend assets to render
Have added review comments with minor nits, then fixed them up + force pushed into the relevant commit. |
e28e3ac
to
fe80078
Compare
Took a good look at this on the review app, looks great! |
Context
We (@duncanjbrown and I) made this change because the same HTML for the header is used across candidate, provider, support and API doc interfaces.
There was a lot of repeated code, and logic in the view that's better isolated outside of the Header component itself.
This repeated code caused a bug whereby the mobile toggle menu button appeared even when there were no menu items to show/hide.
Changes proposed in this pull request
We proposed abstracting the header and navigation items into a component that closely resembles the GOV.UK Frontend Header component.
Link to Trello card
https://trello.com/c/hKy03E02/691-create-header-component