-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit of secondary navigation component * Fix tests * Add more options to secondary navigation * Tweak secondary navigation
- Loading branch information
Showing
12 changed files
with
539 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/nationalarchives/components/secondary-navigation/_index.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@use "secondary-navigation"; |
150 changes: 150 additions & 0 deletions
150
src/nationalarchives/components/secondary-navigation/fixtures.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"component": "secondary navigation", | ||
"fixtures": [ | ||
{ | ||
"name": "default", | ||
"options": { | ||
"title": "Title", | ||
"headingLevel": 2, | ||
"items": [ | ||
{ | ||
"name": "Alpha", | ||
"href": "#/alpha" | ||
}, | ||
{ | ||
"name": "Beta", | ||
"href": "#/beta", | ||
"current": true | ||
}, | ||
{ | ||
"name": "Gamma", | ||
"href": "#/gamma" | ||
} | ||
] | ||
}, | ||
"html": "<nav class=\"tna-secondary-navigation tna-secondary-navigation--unindent\" aria-label=\"Title\"><h2 class=\"tna-secondary-navigation__heading tna-heading-s\">Title</h2><ul class=\"tna-secondary-navigation__items\"><li class=\"tna-secondary-navigation__item\"><a href=\"#/alpha\" class=\"tna-secondary-navigation__link\">Alpha</a></li><li class=\"tna-secondary-navigation__item tna-secondary-navigation__item--current\"><a href=\"#/beta\" class=\"tna-secondary-navigation__link\">Beta</a></li><li class=\"tna-secondary-navigation__item\"><a href=\"#/gamma\" class=\"tna-secondary-navigation__link\">Gamma</a></li></ul></nav>" | ||
}, | ||
{ | ||
"name": "no bottom border", | ||
"options": { | ||
"title": "Title", | ||
"headingLevel": 2, | ||
"items": [ | ||
{ | ||
"name": "Alpha", | ||
"href": "#/alpha" | ||
}, | ||
{ | ||
"name": "Beta", | ||
"href": "#/beta", | ||
"current": true | ||
}, | ||
{ | ||
"name": "Gamma", | ||
"href": "#/gamma" | ||
} | ||
], | ||
"noBottomBorder": true | ||
}, | ||
"html": "<nav class=\"tna-secondary-navigation tna-secondary-navigation--no-bottom-border tna-secondary-navigation--unindent\" aria-label=\"Title\"><h2 class=\"tna-secondary-navigation__heading tna-heading-s\">Title</h2><ul class=\"tna-secondary-navigation__items\"><li class=\"tna-secondary-navigation__item\"><a href=\"#/alpha\" class=\"tna-secondary-navigation__link\">Alpha</a></li><li class=\"tna-secondary-navigation__item tna-secondary-navigation__item--current\"><a href=\"#/beta\" class=\"tna-secondary-navigation__link\">Beta</a></li><li class=\"tna-secondary-navigation__item\"><a href=\"#/gamma\" class=\"tna-secondary-navigation__link\">Gamma</a></li></ul></nav>" | ||
}, | ||
{ | ||
"name": "overflow", | ||
"options": { | ||
"title": "Title", | ||
"headingLevel": 2, | ||
"items": [ | ||
{ | ||
"name": "Alpha", | ||
"href": "#/alpha" | ||
}, | ||
{ | ||
"name": "Beta", | ||
"href": "#/beta", | ||
"current": true | ||
}, | ||
{ | ||
"name": "Gamma", | ||
"href": "#/gamma" | ||
} | ||
], | ||
"overflow": true | ||
}, | ||
"html": "<nav class=\"tna-secondary-navigation tna-secondary-navigation--overflow tna-secondary-navigation--unindent\" aria-label=\"Title\"><h2 class=\"tna-secondary-navigation__heading tna-heading-s\">Title</h2><ul class=\"tna-secondary-navigation__items\"><li class=\"tna-secondary-navigation__item\"><a href=\"#/alpha\" class=\"tna-secondary-navigation__link\">Alpha</a></li><li class=\"tna-secondary-navigation__item tna-secondary-navigation__item--current\"><a href=\"#/beta\" class=\"tna-secondary-navigation__link\">Beta</a></li><li class=\"tna-secondary-navigation__item\"><a href=\"#/gamma\" class=\"tna-secondary-navigation__link\">Gamma</a></li></ul></nav>" | ||
}, | ||
{ | ||
"name": "no unindentation", | ||
"options": { | ||
"title": "Title", | ||
"headingLevel": 2, | ||
"items": [ | ||
{ | ||
"name": "Alpha", | ||
"href": "#/alpha" | ||
}, | ||
{ | ||
"name": "Beta", | ||
"href": "#/beta", | ||
"current": true | ||
}, | ||
{ | ||
"name": "Gamma", | ||
"href": "#/gamma" | ||
} | ||
], | ||
"noUnindentation": true | ||
}, | ||
"html": "<nav class=\"tna-secondary-navigation\" aria-label=\"Title\"><h2 class=\"tna-secondary-navigation__heading tna-heading-s\">Title</h2><ul class=\"tna-secondary-navigation__items\"><li class=\"tna-secondary-navigation__item\"><a href=\"#/alpha\" class=\"tna-secondary-navigation__link\">Alpha</a></li><li class=\"tna-secondary-navigation__item tna-secondary-navigation__item--current\"><a href=\"#/beta\" class=\"tna-secondary-navigation__link\">Beta</a></li><li class=\"tna-secondary-navigation__item\"><a href=\"#/gamma\" class=\"tna-secondary-navigation__link\">Gamma</a></li></ul></nav>" | ||
}, | ||
{ | ||
"name": "with classes", | ||
"options": { | ||
"title": "Title", | ||
"headingLevel": 2, | ||
"items": [ | ||
{ | ||
"name": "Alpha", | ||
"href": "#/alpha" | ||
}, | ||
{ | ||
"name": "Beta", | ||
"href": "#/beta", | ||
"current": true | ||
}, | ||
{ | ||
"name": "Gamma", | ||
"href": "#/gamma" | ||
} | ||
], | ||
"classes": "secondary-navigation__test-class" | ||
}, | ||
"html": "<nav class=\"tna-secondary-navigation secondary-navigation__test-class tna-secondary-navigation--unindent\" aria-label=\"Title\"><h2 class=\"tna-secondary-navigation__heading tna-heading-s\">Title</h2><ul class=\"tna-secondary-navigation__items\"><li class=\"tna-secondary-navigation__item\"><a href=\"#/alpha\" class=\"tna-secondary-navigation__link\">Alpha</a></li><li class=\"tna-secondary-navigation__item tna-secondary-navigation__item--current\"><a href=\"#/beta\" class=\"tna-secondary-navigation__link\">Beta</a></li><li class=\"tna-secondary-navigation__item\"><a href=\"#/gamma\" class=\"tna-secondary-navigation__link\">Gamma</a></li></ul></nav>" | ||
}, | ||
{ | ||
"name": "with attributes", | ||
"options": { | ||
"title": "Title", | ||
"headingLevel": 2, | ||
"items": [ | ||
{ | ||
"name": "Alpha", | ||
"href": "#/alpha" | ||
}, | ||
{ | ||
"name": "Beta", | ||
"href": "#/beta", | ||
"current": true | ||
}, | ||
{ | ||
"name": "Gamma", | ||
"href": "#/gamma" | ||
} | ||
], | ||
"attributes": { | ||
"data-testattribute": "foobar" | ||
} | ||
}, | ||
"html": "<nav class=\"tna-secondary-navigation tna-secondary-navigation--unindent\" aria-label=\"Title\" data-testattribute=\"foobar\"><h2 class=\"tna-secondary-navigation__heading tna-heading-s\">Title</h2><ul class=\"tna-secondary-navigation__items\"><li class=\"tna-secondary-navigation__item\"><a href=\"#/alpha\" class=\"tna-secondary-navigation__link\">Alpha</a></li><li class=\"tna-secondary-navigation__item tna-secondary-navigation__item--current\"><a href=\"#/beta\" class=\"tna-secondary-navigation__link\">Beta</a></li><li class=\"tna-secondary-navigation__item\"><a href=\"#/gamma\" class=\"tna-secondary-navigation__link\">Gamma</a></li></ul></nav>" | ||
} | ||
] | ||
} |
70 changes: 70 additions & 0 deletions
70
src/nationalarchives/components/secondary-navigation/macro-options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[ | ||
{ | ||
"name": "title", | ||
"type": "string", | ||
"required": true, | ||
"description": "" | ||
}, | ||
{ | ||
"name": "headingLevel", | ||
"type": "number", | ||
"required": true, | ||
"description": "" | ||
}, | ||
{ | ||
"name": "items", | ||
"type": "array", | ||
"required": true, | ||
"description": "", | ||
"params": [ | ||
{ | ||
"name": "text", | ||
"type": "string", | ||
"required": true, | ||
"description": "" | ||
}, | ||
{ | ||
"name": "href", | ||
"type": "string", | ||
"required": true, | ||
"description": "" | ||
}, | ||
{ | ||
"name": "current", | ||
"type": "boolean", | ||
"required": false, | ||
"description": "" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "noBottomBorder", | ||
"type": "boolean", | ||
"required": false, | ||
"description": "" | ||
}, | ||
{ | ||
"name": "overflow", | ||
"type": "boolean", | ||
"required": false, | ||
"description": "" | ||
}, | ||
{ | ||
"name": "noUnindentation", | ||
"type": "boolean", | ||
"required": false, | ||
"description": "" | ||
}, | ||
{ | ||
"name": "classes", | ||
"type": "string", | ||
"required": false, | ||
"description": "Classes to add to the secondary navigation." | ||
}, | ||
{ | ||
"name": "attributes", | ||
"type": "object", | ||
"required": false, | ||
"description": "HTML attributes (for example data attributes) to add to the secondary navigation." | ||
} | ||
] |
3 changes: 3 additions & 0 deletions
3
src/nationalarchives/components/secondary-navigation/macro.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% macro tnaSecondaryNavigation(params) %} | ||
{%- include "nationalarchives/components/secondary-navigation/template.njk" -%} | ||
{% endmacro %} |
Oops, something went wrong.