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

Add navigation option #220

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Add navigation option #220

merged 1 commit into from
Dec 19, 2023

Conversation

paulrobertlloyd
Copy link
Collaborator

@paulrobertlloyd paulrobertlloyd commented Dec 12, 2023

Be nice to get a big feature into the 6.0 release, and was thinking the ability to add primary navigation items from the plugin config.

Unfortunately, it’s thrown up a few upstream issues with the prototype components:

Item padding

We’ve adjusted the spacing between items, and no longer have selected items bleed outside the confines of the container, however the items don’t line up with other content on the page, and have too much space between them:

Screenshot 2023-12-12 at 00 12 51

Proposed solution

I think this can be resolved by removing the left and right padding from navigation items:

  .x-govuk-primary-navigation__item {
    box-sizing: border-box;
    display: block;
    float: left;
    line-height: 55px;
    height: 55px;
-   padding: 0 govuk-spacing(3);
    position: relative;
    margin-right: govuk-spacing(6)
  }

Masthead component is too opinionated

The masthead component has a top margin of -10px to account for the blue border below the header. However, this means if anything else appears before it, it gets partially obscured:

Screenshot 2023-12-12 at 00 29 15 Screenshot 2023-12-12 at 00 29 49

If you remove the top margin, and don’t have an adaptation to the header to add a full-width bottom border, you get this:

Screenshot 2023-12-12 at 00 38 10

These components are all frustratingly dependent on each other in different ways.

Proposed solution

The negative margin seems like a code smell, so should probably be removed from the masthead component.

Then, in this plugin’s layouts, we need to programmatically decide when to add a header modifying class to give it a full border width.

@paulrobertlloyd paulrobertlloyd added this to the 6.0 milestone Dec 12, 2023
@paulrobertlloyd paulrobertlloyd added enhancement New feature or request dependencies Pull requests that update a dependency file labels Dec 12, 2023
@frankieroberto
Copy link
Contributor

@paulrobertlloyd Makes sense to me.

I made a similar change to the primary navigation in a prototype, removing the padding and replacing it with a 20px margin on the right instead (was going to suggest this change in the prototype filters but forgot).

Agree with removing the negative margin from the masthead.

For the header, I wonder if we should have modifiers for both a full-width blue border (see code) and no blue border (for when you have a masthead underneath)?

@paulrobertlloyd paulrobertlloyd marked this pull request as ready for review December 19, 2023 22:23
@paulrobertlloyd
Copy link
Collaborator Author

Will add tests and documentation in a separate PR.

@paulrobertlloyd paulrobertlloyd merged commit 8d15325 into main Dec 19, 2023
2 checks passed
@paulrobertlloyd paulrobertlloyd deleted the primary-navigation branch December 19, 2023 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants