From 100048c6786d6c1cc3a34e4afa9179244c0b6edb Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Wed, 4 Oct 2023 18:10:02 +0100 Subject: [PATCH] Tweak heading sizes on cards --- CHANGELOG.md | 1 + .../components/card/card.stories.js | 18 +++++------ .../components/card/fixtures.json | 32 +++++++++---------- .../components/card/template.njk | 4 +-- .../colour-schemes/colour-schemes.stories.js | 2 +- .../utilities/_typography.scss | 7 +++- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 144e4e50..755f0321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - In coloured blocks, the custom CSS property `--background` now gets explictly replaced with `--accent-background`, `--contrast-background` or `--accent-background-light` - `typography.$base-font-size-px` is now `typography.$relative-1rem-px` - `xl` and `l` headings are Supria Sans and `m` and `s` are Open Sans +- Card heading size defaults to `s` ### Deprecated ### Removed diff --git a/src/nationalarchives/components/card/card.stories.js b/src/nationalarchives/components/card/card.stories.js index 405ca0bf..fcde1180 100644 --- a/src/nationalarchives/components/card/card.stories.js +++ b/src/nationalarchives/components/card/card.stories.js @@ -5,7 +5,7 @@ const argTypes = { supertitle: { control: "text" }, title: { control: "text" }, headingLevel: { control: { type: "number", min: 1, max: 6 } }, - headingSize: { control: "inline-radio", options: ["m", "l"] }, + headingSize: { control: "inline-radio", options: ["s", "m", "l"] }, href: { control: "text" }, imageSrc: { control: { type: "file", accept: ".jpg" } }, imageAlt: { control: "text" }, @@ -89,7 +89,7 @@ Standard.args = { supertitle: "Card supertitle", title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", href: "#", imageSrc: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg", @@ -106,7 +106,7 @@ export const Simple = Template.bind({}); Simple.args = { title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", imageSrc: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg", imageAlt: "The National Archives office", @@ -122,7 +122,7 @@ Meta.args = { supertitle: "Card supertitle", title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", href: "#", imageSrc: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg", @@ -145,7 +145,7 @@ Boxed.args = { supertitle: "Card supertitle", title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", href: "#", imageSrc: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg", @@ -164,7 +164,7 @@ Accent.args = { supertitle: "Card supertitle", title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", href: "#", imageSrc: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg", @@ -263,7 +263,7 @@ Sources.args = { supertitle: "Card supertitle", title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", imageSrc: "https://www.gstatic.com/webp/gallery/2.jpg", imageAlt: "A man in a canoe paddling through white water", imageWidth: 550, @@ -284,7 +284,7 @@ WithoutImage.args = { supertitle: "Card supertitle", title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", body: "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis.

", htmlElement: "article", classes: "tna-card--demo", @@ -345,7 +345,7 @@ export const Grid = GridTemplate.bind({}); Grid.args = { title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", href: "#", imageSrc: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg", diff --git a/src/nationalarchives/components/card/fixtures.json b/src/nationalarchives/components/card/fixtures.json index 42a7f341..cd5ec478 100644 --- a/src/nationalarchives/components/card/fixtures.json +++ b/src/nationalarchives/components/card/fixtures.json @@ -8,7 +8,7 @@ "headingLevel": 3, "body": "

Card body

" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -19,7 +19,7 @@ "headingLevel": 3, "body": "

Card body

" }, - "html": "

Card supertitleCard title

Card body

", + "html": "

Card supertitleCard title

Card body

", "hidden": false }, { @@ -40,7 +40,7 @@ "headingLevel": 1, "body": "

Card body

" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -51,7 +51,7 @@ "href": "#", "body": "

Card body

" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -75,7 +75,7 @@ ], "body": "

Card body

" }, - "html": "

Card title

  • 24th September 2023
  • From £16
  • Online

Card body

", + "html": "

Card title

  • 24th September 2023
  • From £16
  • Online

Card body

", "hidden": false }, { @@ -85,7 +85,7 @@ "headingLevel": 3, "text": "Card body" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -99,7 +99,7 @@ "imageHeight": 360, "body": "

Card body

" }, - "html": "

Card title

\"A

Card body

", + "html": "

Card title

\"A

Card body

", "hidden": false }, { @@ -119,7 +119,7 @@ ], "body": "

Card body

" }, - "html": "

Card title

\"A

Card body

", + "html": "

Card title

\"A

Card body

", "hidden": false }, { @@ -134,7 +134,7 @@ "href": "#", "body": "

Card body

" }, - "html": "

Card title

\"A

Card body

", + "html": "

Card title

\"A

Card body

", "hidden": false }, { @@ -151,7 +151,7 @@ } ] }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -162,7 +162,7 @@ "label": "New", "body": "

Card body

" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -173,7 +173,7 @@ "body": "

Card body

", "style": "boxed" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -184,7 +184,7 @@ "body": "

Card body

", "style": "accent" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -195,7 +195,7 @@ "body": "

Card body

", "style": "foobar" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -206,7 +206,7 @@ "body": "

Card body

", "classes": "card__test-class" }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false }, { @@ -219,7 +219,7 @@ "data-testattribute": "foobar" } }, - "html": "

Card title

Card body

", + "html": "

Card title

Card body

", "hidden": false } ] diff --git a/src/nationalarchives/components/card/template.njk b/src/nationalarchives/components/card/template.njk index 1a0b2b65..d81b3f1c 100644 --- a/src/nationalarchives/components/card/template.njk +++ b/src/nationalarchives/components/card/template.njk @@ -11,7 +11,7 @@ <{{ htmlElement }} class="tna-card {{ containerClasses | join(' ') }}" data-module="tna-card" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{%- if params.supertitle -%} -
+
{{ params.supertitle }} {%- if params.href -%} @@ -22,7 +22,7 @@
{%- else -%} - + {%- if params.href -%} {{ params.title }} {%- else -%} diff --git a/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js b/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js index cb73782b..2e885fd0 100644 --- a/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js +++ b/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js @@ -41,7 +41,7 @@ const Template = ({ theme, accent }) => { supertitle: "Card supertitle", title: "Card title", headingLevel: 3, - headingSize: "m", + headingSize: "s", href: "#", imageSrc: "https://www.nationalarchives.gov.uk/wp-content/uploads/sites/24/2023/07/tna-building-compress.jpg", diff --git a/src/nationalarchives/utilities/_typography.scss b/src/nationalarchives/utilities/_typography.scss index f735ad1e..f8bc26ab 100644 --- a/src/nationalarchives/utilities/_typography.scss +++ b/src/nationalarchives/utilities/_typography.scss @@ -411,7 +411,7 @@ small { .tna-hgroup { &__supertitle { - margin: 0 0 0.5rem; + margin: 0 0 0.25rem; @extend %chip; } @@ -446,6 +446,11 @@ small { margin-top: 3rem; margin-bottom: 1rem; + // &--m, + // &--s { + // margin-bottom: 0.5rem; + // } + &:first-child { margin-top: 0; }