Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
add display text option for sidebar component
Browse files Browse the repository at this point in the history
* add display text option for sidebar component

* update package version
  • Loading branch information
BobbyCGD authored Jul 16, 2021
1 parent a9e232b commit 7d20148
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions app/components/side-navigation/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<div class="nhsuk-side-navigation-container" >
{{ sideNavigation({
items: [
{ id: "about" },
{ id: "features" },
{ id: "testimonials" },
{ id: "next_steps" }
{ id: "about", display: "About" },
{ id: "features", display: "Features" },
{ id: "testimonials", display: "Testimonials" },
{ id: "next_steps", display: "Next Steps" }
]
}) }}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nwisbeta/nhswales-frontend",
"version": "0.0.7-alpha",
"version": "0.0.8-alpha",
"description": "NHS.Wales frontend contains the code you need to start building user interfaces for NHS websites and services.",
"scripts": {
"prepare": "gulp bundle",
Expand Down
11 changes: 6 additions & 5 deletions packages/components/side-navigation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Find out more about the Side Navigation component and when to use it in the[NHS
<div class="nhsuk-side-navigation-container" >
{{ sideNavigation({
items: [
{ id: "about" },
{ id: "features" }
{ id: "about", display: "About" },
{ id: "features", display: "Features" }
]
}) }}
<div class="nhsuk-side-navigation-options">
Expand Down Expand Up @@ -51,8 +51,8 @@ Find out more about the Side Navigation component and when to use it in the[NHS
<div class="nhsuk-side-navigation-container" >
{{ sideNavigation({
items: [
{ id: "about" },
{ id: "features" }
{ id: "about", display: "About" },
{ id: "features", display: "Features" }
]
}) }}

Expand All @@ -76,6 +76,7 @@ The Side Navigation Nunjucks macro takes the following arguments:
| Name | Type | Required | Description |
| ------------------------|----------|-----------|--------------|
| **items** | array | Yes | Array of items in the Side Navigation. |
| **items.[].id** | string | Yes | Id value of a section to point to. |
| **items.[].id** | string | Yes | Id value of a section to point to. |
| **items.[].display** | string | Yes | Display text for the menu option. |

If you are using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `html` can be a [security risk](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Read more about this in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).
2 changes: 1 addition & 1 deletion packages/components/side-navigation/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ul class="nhsuk-side-navigation__list">
{%- for item in params.items %}
<li class="nhsuk-side-navigation__item">
<a class="nhsuk-side-navigation__link" href="#{{ item.id }}">{{ item.id | replace("_", " ") | capitalize }}</a>
<a class="nhsuk-side-navigation__link" href="#{{ item.id }}">{{ item.display }}</a>
</li>
{%- endfor %}
</ul>
Expand Down

0 comments on commit 7d20148

Please sign in to comment.