Skip to content

Commit

Permalink
Add more fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Nov 30, 2023
1 parent 54e0be0 commit 0c94359
Show file tree
Hide file tree
Showing 24 changed files with 781 additions and 53 deletions.
1 change: 1 addition & 0 deletions .htmlvalidate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"close-order": "error",
"form-dup-name": 0,
"no-inline-style": 0,
"no-redundant-role": 0,
"no-trailing-whitespace": 0,
"void-style": 0
}
Expand Down
20 changes: 10 additions & 10 deletions src/nationalarchives/components/cookie-banner/fixtures.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/nationalarchives/components/cookie-banner/template.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% from "nationalarchives/components/button/macro.njk" import tnaButton %}

{%- set containerClasses = [params.classes] if params.classes else [] -%}
<section class="tna-cookie-banner {{ containerClasses | join(' ') }}" data-module="tna-cookie-banner" data-policies="{{ params.policies if params.policies }}" data-preferenceskey="{{ params.preferencesSetKey if params.preferencesSetKey else 'cookie_preferences_set' }}" data-policies-key="{{ params.policiesKey if params.policiesKey }}" data-domain="{{ params.cookiesDomain if params.cookiesDomain }}" data-path="{{ params.cookiesPath if params.cookiesPath }}" data-insecure="{{ true if params.allowInsecure else 'false' }}" aria-label="Cookies on {{ params.serviceName }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} hidden>
<section class="tna-cookie-banner {{ containerClasses | join(' ') }}" data-module="tna-cookie-banner" role="region" data-policies="{{ params.policies if params.policies }}" data-preferenceskey="{{ params.preferencesSetKey if params.preferencesSetKey else 'cookie_preferences_set' }}" data-policies-key="{{ params.policiesKey if params.policiesKey }}" data-domain="{{ params.cookiesDomain if params.cookiesDomain }}" data-path="{{ params.cookiesPath if params.cookiesPath }}" data-insecure="{{ true if params.allowInsecure else 'false' }}" aria-label="Cookies on {{ params.serviceName }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} hidden>
<div class="tna-container">
<div class="tna-column tna-column--full tna-cookie-banner__message tna-cookie-banner__message--prompt">
<h2 class="tna-heading-m">This website uses cookies</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/date-search/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{%- if params.inline -%}
{%- set containerClasses = containerClasses.concat('tna-form__group--inline') -%}
{%- endif -%}
<div class="tna-form__group{% if params.error %} tna-form__group--error{% endif %} {{ containerClasses | join(' ') }} {%- for attribute, value in params.formGroupAttributes %} {{ attribute }}="{{ value }}"{% endfor %}">
<div class="tna-form__group{% if params.error %} tna-form__group--error{% endif %} {{ containerClasses | join(' ') }}" {%- for attribute, value in params.formGroupAttributes %} {{ attribute }}="{{ value }}"{% endfor %}>
<div class="tna-form__group-contents">
<h{{ params.headingLevel }} class="tna-form__heading tna-form__heading--{{ params.headingSize or 'm' }}">
<label class="tna-form__label" for="tna-form__{{ params.id }}">
Expand Down
42 changes: 41 additions & 1 deletion src/nationalarchives/components/featured-records/fixtures.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
{
"component": "featured-records",
"fixtures": []
"fixtures": [
{
"name": "basic featured records",
"options": {
"items": [
{
"collection": "TS 11/45/167",
"title": "Court records relating to Robert Wedderburn's trial",
"href": "#",
"date": "1819–1820"
},
{
"collection": "HO 42/191",
"title": "Home office letters",
"href": "#",
"date": "1819"
}
]
},
"html": "<ul class=\"tna-featured-records \"><li class=\"tna-featured-records__item\"><dl class=\"tna-featured-records__details\"><dt class=\"tna-featured-records__collection-label tna-chip tna-chip--plain\">From our collection</dt><dd class=\"tna-featured-records__collection-description tna-chip tna-chip--plain\">TS 11/45/167</dd><dt class=\"tna-featured-records__title-label\">Title</dt><dd class=\"tna-featured-records__title-description\"><a href=\"#\">Court records relating to Robert Wedderburn&#39;s trial</a></dd><dt class=\"tna-featured-records__date-label\">Date</dt><dd class=\"tna-featured-records__date-description\">1819–1820</dd></dl></li><li class=\"tna-featured-records__item\"><dl class=\"tna-featured-records__details\"><dt class=\"tna-featured-records__collection-label tna-chip tna-chip--plain\">From our collection</dt><dd class=\"tna-featured-records__collection-description tna-chip tna-chip--plain\">HO 42/191</dd><dt class=\"tna-featured-records__title-label\">Title</dt><dd class=\"tna-featured-records__title-description\"><a href=\"#\">Home office letters</a></dd><dt class=\"tna-featured-records__date-label\">Date</dt><dd class=\"tna-featured-records__date-description\">1819</dd></dl></li></ul>",
"hidden": false
},
{
"name": "featured records with images",
"options": {
"items": [
{
"imageSrc": "https://beta.nationalarchives.gov.uk/media/images/wedderburn-trial.max-832x591.format-webp_i3c9pUH.webp",
"imageWidth": 576,
"imageHeight": 591,
"collection": "TS 11/45/167",
"title": "Court records relating to Robert Wedderburn's trial",
"href": "#",
"date": "1819–1820"
}
]
},
"html": "<ul class=\"tna-featured-records \"><li class=\"tna-featured-records__item\"><img src=\"https://beta.nationalarchives.gov.uk/media/images/wedderburn-trial.max-832x591.format-webp_i3c9pUH.webp\" width=\"576\" height=\"591\" class=\"tna-featured-records__image\" alt=\"\"><dl class=\"tna-featured-records__details\"><dt class=\"tna-featured-records__collection-label tna-chip tna-chip--plain\">From our collection</dt><dd class=\"tna-featured-records__collection-description tna-chip tna-chip--plain\">TS 11/45/167</dd><dt class=\"tna-featured-records__title-label\">Title</dt><dd class=\"tna-featured-records__title-description\"><a href=\"#\">Court records relating to Robert Wedderburn&#39;s trial</a></dd><dt class=\"tna-featured-records__date-label\">Date</dt><dd class=\"tna-featured-records__date-description\">1819–1820</dd></dl></li></ul>",
"hidden": false
}
]
}
26 changes: 12 additions & 14 deletions src/nationalarchives/components/filters/filters.scss
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
@use "../../tools/colour";
@use "../../tools/spacing";
@use "../../utilities";

.tna-filters {
@include spacing.space-above;

display: flex;
flex-wrap: wrap;
gap: 0.75rem 1rem;

@include spacing.space-above;

&__item {
}

&__item--selected #{&}__link {
background-color: #004c7e;

&,
&:link,
&:visited {
color: #fff;
}
&:visited,
&:hover {
@include colour.accent;
}
}

&__link {
padding: 0.125rem 0.75rem;

text-decoration: none;

background-color: #d4e5ef;

border-radius: 99rem;
@include colour.tint;

&,
&:link,
&:visited {
color: #000;
@include colour.colour-font("font-base");
}

&:hover {
color: #fff;
border-radius: 99rem;

background-color: #004c7e;
&:hover {
@include colour.accent-light;
}
}
}
49 changes: 48 additions & 1 deletion src/nationalarchives/components/filters/fixtures.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
{
"component": "filters",
"fixtures": []
"fixtures": [
{
"name": "plain filters",
"options": {
"items": [
{
"label": "All",
"href": "#?filter=all",
"selected": true
},
{
"label": "Medieval (974—1485)",
"href": "#?filter=alpha"
},
{
"label": "Early Modern (1485—1714)",
"href": "#?filter=beta"
},
{
"label": "Georgians (1714—1837)",
"href": "#?filter=gamma"
},
{
"label": "Victorians (1837—1901)",
"href": "#?filter=delta"
},
{
"label": "Early 20th century (1901—1918)",
"href": "#?filter=epsilon"
},
{
"label": "Interwar (1918—1939)",
"href": "#?filter=zeta"
},
{
"label": "Second World War (1939—1945)",
"href": "#?filter=eta"
},
{
"label": "Postwar (1945—2000)",
"href": "#?filter=theta"
}
]
},
"html": "<ul class=\"tna-filters tna-ul tna-ul--plain \"><li class=\"tna-filters__item tna-filters__item--selected\"><a href=\"#?filter=all\" class=\"tna-filters__link\">All</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=alpha\" class=\"tna-filters__link\">Medieval (974—1485)</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=beta\" class=\"tna-filters__link\">Early Modern (1485—1714)</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=gamma\" class=\"tna-filters__link\">Georgians (1714—1837)</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=delta\" class=\"tna-filters__link\">Victorians (1837—1901)</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=epsilon\" class=\"tna-filters__link\">Early 20th century (1901—1918)</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=zeta\" class=\"tna-filters__link\">Interwar (1918—1939)</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=eta\" class=\"tna-filters__link\">Second World War (1939—1945)</a></li><li class=\"tna-filters__item\"><a href=\"#?filter=theta\" class=\"tna-filters__link\">Postwar (1945—2000)</a></li></ul>",
"hidden": false
}
]
}
148 changes: 148 additions & 0 deletions src/nationalarchives/components/footer/fixtures.json

Large diffs are not rendered by default.

50 changes: 49 additions & 1 deletion src/nationalarchives/components/header/fixtures.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
{
"component": "header",
"fixtures": []
"fixtures": [
{
"name": "default",
"options": {
"logo": {
"strapline": "Beta",
"href": "#/"
},
"topNavigation": [
{
"text": "Top item 1",
"href": "#/top-1"
},
{
"text": "Top item 2",
"href": "#/top-2",
"icon": "phone"
},
{
"text": "Top item 3",
"href": "#/top-3",
"brandIcon": "github"
}
],
"navigation": [
{
"text": "Alpha",
"href": "#/alpha",
"selected": true
},
{
"text": "Beta",
"href": "#/beta"
},
{
"text": "Gamma",
"href": "#/gamma"
}
],
"exit": {
"text": "Go to the current National Archives website",
"href": "#",
"target": "_blank"
}
},
"html": "<header class=\"tna-header \" data-module=\"tna-header\"><div class=\"tna-header__exit\"><div class=\"tna-container\"><div class=\"tna-column tna-column--full\"><a href=\"#\" class=\"tna-header__exit-link\" target=\"_blank\">Go to the current National Archives website<i class=\"fa-solid fa-arrow-up-right-from-square\"></i></a></div></div></div><div class=\"tna-container tna-header__contents\"><div class=\"tna-column tna-header__logo\"><a href=\"#/\" class=\"tna-header__logo-link tna-header__logo-link--href\" title=\"The National Archives - Beta\"><svg xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\" class=\"tna-logo\" style=\"enable-background:new 0 0 160 160\" viewBox=\"0 0 160 160\" width=\"96\" height=\"96\"><path fill=\"#fff\" d=\"M0 0h160v160H0z\" class=\"tna-logo__background\"/><g class=\"tna-logo__foreground\" fill=\"#000\"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1c0-.2.1-.5.1-.7 0-1.7-.6-3.2-3-3.2-2.1 0-3 1.2-3 2.8 0 1.7.9 2.5 2.2 2.9l3.5 1.3c2.6 1 4.3 2.6 4.3 5.8 0 3.6-2.4 6.1-7 6.1-5.9 0-6.8-3.9-6.8-6.5 0-.3 0-.6.1-1l3.3-.1z\"/></g></svg><span class=\"tna-header__logo-strapline\">Beta</span></a></div><div class=\"tna-column tna-column--flex-1- tna-header__navigation-toggle\"><!-- POPULATED BY JAVASCRIPT IF ENABLED --></div><nav class=\"tna-column tna-column--flex-1 tna-column--full-small tna-column--full-tiny tna-header__navigation\" aria-label=\"Main site navigation\"><ul class=\"tna-header__navigation-items\"><li class=\"tna-header__navigation-item\"><a href=\"#/alpha\" class=\"tna-header__navigation-item-link tna-header__navigation-item-link--selected\" tabindex=\"0\" aria-current=\"true\">Alpha</a></li><li class=\"tna-header__navigation-item\"><a href=\"#/beta\" class=\"tna-header__navigation-item-link\" tabindex=\"0\">Beta</a></li><li class=\"tna-header__navigation-item\"><a href=\"#/gamma\" class=\"tna-header__navigation-item-link\" tabindex=\"0\">Gamma</a></li></ul><ul class=\"tna-header__top-navigation-items\"><li class=\"tna-header__top-navigation-item\"><a href=\"#/top-1\" class=\"tna-header__top-navigation-item-link\" tabindex=\"0\">Top item 1</a></li><li class=\"tna-header__top-navigation-item\"><a href=\"#/top-2\" class=\"tna-header__top-navigation-item-link\" tabindex=\"0\"><i class=\"fa-solid fa-fw fa-phone\"></i>Top item 2</a></li><li class=\"tna-header__top-navigation-item\"><a href=\"#/top-3\" class=\"tna-header__top-navigation-item-link\" tabindex=\"0\"><i class=\"fa-brands fa-fw fa-github\"></i>Top item 3</a></li></ul></nav></div></header>",
"hidden": false
}
]
}
2 changes: 1 addition & 1 deletion src/nationalarchives/components/header/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="tna-header__exit">
<div class="tna-container">
<div class="tna-column tna-column--full">
<a href="{{ params.exit.href }}" class="tna-header__exit-link"{%- if params.exit.target -%} target="{{ params.exit.target }}"{%- endif -%}>
<a href="{{ params.exit.href }}" class="tna-header__exit-link"{%- if params.exit.target %} target="{{ params.exit.target }}"{%- endif -%}>
{{ params.exit.text }}
{%- if params.exit.target == "_blank" -%}
<i class="fa-solid fa-arrow-up-right-from-square"></i>
Expand Down
11 changes: 10 additions & 1 deletion src/nationalarchives/components/message/fixtures.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"component": "message",
"fixtures": []
"fixtures": [
{
"name": "default",
"options": {
"message": "Please note this page references hunger strikes and force feeding, which some people may find upsetting."
},
"html": "<div class=\"tna-message \"><svg class=\"tna-message__icon\" xmlns=\"http://www.w3.org/2000/svg\" focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 34 34\" width=\"40\" height=\"40\"><path fill=\"currentColor\" d=\"M15.33 8.67h3.34V12h-3.34V8.67Zm0 6.66h3.34v10h-3.34v-10ZM17 .33a16.67 16.67 0 1 0 .01 33.35A16.67 16.67 0 0 0 17 .33Zm0 30A13.35 13.35 0 0 1 3.67 17C3.67 9.65 9.65 3.67 17 3.67S30.33 9.65 30.33 17 24.35 30.33 17 30.33Z\"></path></svg><p class=\"tna-message__message\">Please note this page references hunger strikes and force feeding, which some people may find upsetting.</p></div>",
"hidden": false
}
]
}
45 changes: 44 additions & 1 deletion src/nationalarchives/components/pagination/fixtures.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
{
"component": "pagination",
"fixtures": []
"fixtures": [
{
"name": "default",
"options": {
"previous": {
"href": "#"
},
"items": [
{
"number": 1,
"href": "#"
},
{
"ellipsis": true
},
{
"number": 6,
"href": "#"
},
{
"number": 7,
"current": true,
"href": "#"
},
{
"number": 8,
"href": "#"
},
{
"ellipsis": true
},
{
"number": 42,
"href": "#"
}
],
"next": {
"href": "#"
}
},
"html": "<nav class=\"tna-pagination \" role=\"navigation\" aria-label=\"Pagination\"><div class=\"tna-pagination__prev\"><a href=\"#\" class=\"tna-button tna-button--icon-only-mobile\" rel=\"prev\"><i class=\"fa-solid fa-fw fa-arrow-left\" aria-hidden=\"true\"></i>Previous</a></div><ul class=\"tna-pagination__list\"><li class=\"tna-pagination__item\"><a href=\"#\" class=\"tna-button tna-pagination__link\" aria-label=\"\">1</a></li><li class=\"tna-pagination__item tna-pagination__item--ellipses\">&ctdot;</li><li class=\"tna-pagination__item\"><a href=\"#\" class=\"tna-button tna-pagination__link\" aria-label=\"\">6</a></li><li class=\"tna-pagination__item tna-pagination__item--current\"><a href=\"#\" class=\"tna-button tna-pagination__link tna-button--accent\" aria-label=\"\">7</a></li><li class=\"tna-pagination__item\"><a href=\"#\" class=\"tna-button tna-pagination__link\" aria-label=\"\">8</a></li><li class=\"tna-pagination__item tna-pagination__item--ellipses\">&ctdot;</li><li class=\"tna-pagination__item\"><a href=\"#\" class=\"tna-button tna-pagination__link\" aria-label=\"\">42</a></li></ul><div class=\"tna-pagination__next\"><a href=\"#\" class=\"tna-button tna-button--icon-right tna-button--icon-only-mobile\" rel=\"next\"><i class=\"fa-solid fa-fw fa-arrow-right\" aria-hidden=\"true\"></i>Next</a></div></nav>",
"hidden": false
}
]
}
Loading

0 comments on commit 0c94359

Please sign in to comment.