govuk-one-login / service-header

A header for services using GOV.UK One Login
https://govuk-one-login.github.io/service-header/
6 stars 4 forks source link

Tweak header nunjucks template and wrapping behaviour #6

Closed danacotoran closed 1 year ago

danacotoran commented 1 year ago

Tip: when reviewing the code, might be best to focus on reviewing src which are source files, whereas dist is output files.

  1. Update nunjucks template to make it easier to integrate the header into prototypes using the Prototype Kit. Now the entire header NJK file can be copied into prototypes' layout templates (or a separate partial to be referenced in the templates).

Navigation links and the name of the service can be set in the view, using the set syntax in Nunjucks, e.g.

{% set serviceName = 'Apply for a juggling licence' %}

{% set navigationItems = [
  {
    active: true,
    href: "#",
    text: 'Example link 1'
  },{
    href: "#",
    text: 'Example link 2'
  },{
    href: "#",
    text: 'Example link 3'
  }]
%}
  1. Tweak subnavigation wrapping behaviour so that the heading and links collapse into a stacked layout when either one is too long to comfortably fit onto one line.

Default layout

Screenshot 2023-06-02 at 11 26 27

Service name too long

Screenshot 2023-06-02 at 11 26 44

Links too long

Screenshot 2023-06-02 at 11 27 48

Service name AND links too long

Screenshot 2023-06-02 at 11 27 25
danacotoran commented 1 year ago

Thanks @wilsond-gds Great shout regarding the size of the touch area (in fact there already is an issue to do with it in our backlog, just need UCD consensus on it first before I implement a fix)! Re: flex vs inline-block, to be honest I just didn't necessarily see a reason to use flex for the current design. Might consider it should the design require it, but I don't think it's necessary as it is right now.