NHSLeadership / nightingale-wp

Other
1 stars 0 forks source link

[refs #00089] Allow for subnavs without panels #90

Closed Android63 closed 6 years ago

Android63 commented 6 years ago

Fix error when subnav lacks a panel.

Now, when a subnav has a panel, it looks like this:

screen shot 2017-12-14 at 15 45 46

And without a panel, it looks like this:

screen shot 2017-12-14 at 15 47 00
Android63 commented 6 years ago

If a submenu panel exists, it takes up 3/4 of the page, leaving 1/4 for the submenu items which are themselves split into 2 columns.

If there is no subpanel, the submenu columns take up the full page width.

The submenu items are distributed evenly across the 2 columns based on the number of items. The algorithm for this can cope with a different number of columns so that if, for example, it was decided that full width submenus should have 3 or 4 columns, that will be a simple change.

With submenu panel: screen shot 2017-12-22 at 11 12 55

Without panel: screen shot 2017-12-22 at 11 12 25

Android63 commented 6 years ago

@cehwitham could you take a look at this when you get a chance please?

Android63 commented 6 years ago

Markup is now clean and we can now add primary and secondary buttons as shown in this screenshot:

screen shot 2018-01-17 at 10 05 32

I have updated the wiki to reflect these changes.

@cehwitham could you please review?

Android63 commented 6 years ago

I can confirm that valid HTML is generated under the following conditions:

  1. All elements present.
  2. All elements except description present.
  3. All elements except primary button present.
  4. All elements except secondary button present.
  5. Only title and links present.
  6. Only links present (no panel).
  7. Only panel present (no links).

The only way I was able to break this was by having panel elements (such as description, buttons, etc.) without a panel header. This breaks the layout because the header is used to open the panel and so, without it, it doesn't get closed and the elements that should be in it are left stranded.