diff --git a/CHANGELOG.md b/CHANGELOG.md
index 903c5214..23c32beb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Index grids can now have supertitles, `hrefClasses` and `hrefAttributes`
+- Quick filters component styling has changed and has a new `fill` option
### Changed
diff --git a/src/nationalarchives/components/compound-filters/compound-filters.scss b/src/nationalarchives/components/compound-filters/compound-filters.scss
index de4506b8..88e967f7 100644
--- a/src/nationalarchives/components/compound-filters/compound-filters.scss
+++ b/src/nationalarchives/components/compound-filters/compound-filters.scss
@@ -8,7 +8,7 @@
display: flex;
flex-wrap: wrap;
align-items: center;
- gap: spacing.space(0.75) spacing.space(1);
+ gap: spacing.space(0.5) spacing.space(0.75);
list-style: none;
diff --git a/src/nationalarchives/components/quick-filters/fixtures.json b/src/nationalarchives/components/quick-filters/fixtures.json
index 7839d0c5..d6616b56 100644
--- a/src/nationalarchives/components/quick-filters/fixtures.json
+++ b/src/nationalarchives/components/quick-filters/fixtures.json
@@ -44,7 +44,89 @@
}
]
},
- "html": "
",
+ "html": "",
+ "hidden": false
+ },
+ {
+ "name": "stacked",
+ "options": {
+ "items": [
+ {
+ "label": "All",
+ "href": "#?filter=all",
+ "selected": true
+ },
+ {
+ "label": "Alpha",
+ "href": "#?filter=alpha"
+ },
+ {
+ "label": "Beta",
+ "href": "#?filter=beta"
+ },
+ {
+ "label": "Gamma",
+ "href": "#?filter=gamma"
+ }
+ ],
+ "stack": true
+ },
+ "html": "",
+ "hidden": false
+ },
+ {
+ "name": "filled",
+ "options": {
+ "items": [
+ {
+ "label": "All",
+ "href": "#?filter=all",
+ "selected": true
+ },
+ {
+ "label": "Alpha",
+ "href": "#?filter=alpha"
+ },
+ {
+ "label": "Beta",
+ "href": "#?filter=beta"
+ },
+ {
+ "label": "Gamma",
+ "href": "#?filter=gamma"
+ }
+ ],
+ "fill": true
+ },
+ "html": "",
+ "hidden": false
+ },
+ {
+ "name": "stacked and filled",
+ "options": {
+ "items": [
+ {
+ "label": "All",
+ "href": "#?filter=all",
+ "selected": true
+ },
+ {
+ "label": "Alpha",
+ "href": "#?filter=alpha"
+ },
+ {
+ "label": "Beta",
+ "href": "#?filter=beta"
+ },
+ {
+ "label": "Gamma",
+ "href": "#?filter=gamma"
+ }
+ ],
+ "stack": true,
+ "fill": true
+ },
+ "html": "",
"hidden": false
}
]
diff --git a/src/nationalarchives/components/quick-filters/macro-options.json b/src/nationalarchives/components/quick-filters/macro-options.json
index 56751303..d784bd32 100644
--- a/src/nationalarchives/components/quick-filters/macro-options.json
+++ b/src/nationalarchives/components/quick-filters/macro-options.json
@@ -37,6 +37,12 @@
"required": false,
"description": ""
},
+ {
+ "name": "fill",
+ "type": "boolean",
+ "required": false,
+ "description": ""
+ },
{
"name": "classes",
"type": "string",
diff --git a/src/nationalarchives/components/quick-filters/quick-filters.scss b/src/nationalarchives/components/quick-filters/quick-filters.scss
index 6afd5813..e3028522 100644
--- a/src/nationalarchives/components/quick-filters/quick-filters.scss
+++ b/src/nationalarchives/components/quick-filters/quick-filters.scss
@@ -6,25 +6,42 @@
display: flex;
flex-wrap: wrap;
- gap: spacing.space(0.75) spacing.space(1);
+ gap: spacing.space(0.5) spacing.space(0.75);
list-style: none;
&--stacked {
flex-direction: column;
+ align-items: flex-start;
+ }
+
+ &--filled {
+ align-items: flex-start;
+ }
+
+ &--stacked#{&}--filled {
+ align-items: stretch;
}
&__item {
}
+ &--filled &__item {
+ flex: 1 1 auto;
+
+ text-align: center;
+ }
+
&__link {
- padding: spacing.space(0.125) spacing.space(0.75);
+ padding: 0 spacing.space(0.75);
+
+ display: block;
line-height: 1.75;
text-decoration: none;
- border-radius: 1rem;
+ // border-radius: 1rem;
@include colour.colour-border("keyline", 1px);
@@ -33,6 +50,10 @@
&:visited {
@include colour.colour-font("font-base");
}
+
+ &:hover {
+ @include colour.tint;
+ }
}
&__item--selected &__link {
@@ -41,6 +62,7 @@
&:visited,
&:hover {
@include colour.accent;
+ @include colour.colour-border("background");
}
}
}
diff --git a/src/nationalarchives/components/quick-filters/quick-filters.stories.js b/src/nationalarchives/components/quick-filters/quick-filters.stories.js
index 40dcb9af..90f62669 100644
--- a/src/nationalarchives/components/quick-filters/quick-filters.stories.js
+++ b/src/nationalarchives/components/quick-filters/quick-filters.stories.js
@@ -4,6 +4,7 @@ import macroOptions from "./macro-options.json";
const argTypes = {
items: { control: "object" },
stack: { control: "boolean" },
+ fill: { control: "boolean" },
classes: { control: "text" },
attributes: { control: "object" },
};
@@ -19,11 +20,12 @@ export default {
argTypes,
};
-const Template = ({ items, stack, classes, attributes }) =>
+const Template = ({ items, stack, fill, classes, attributes }) =>
Filters({
params: {
items,
stack,
+ fill,
classes,
attributes,
},
diff --git a/src/nationalarchives/components/quick-filters/template.njk b/src/nationalarchives/components/quick-filters/template.njk
index 20228f08..a7354a59 100644
--- a/src/nationalarchives/components/quick-filters/template.njk
+++ b/src/nationalarchives/components/quick-filters/template.njk
@@ -1,5 +1,5 @@
{%- set containerClasses = [params.classes] if params.classes else [] -%}
-