diff --git a/.storybook/storybook.scss b/.storybook/storybook.scss index 6aa1c88c..d6dff1f0 100644 --- a/.storybook/storybook.scss +++ b/.storybook/storybook.scss @@ -182,7 +182,7 @@ } &__block { - width: #{math.div(100%, 6)}; + // width: #{math.div(100%, 6)}; padding: 1rem; display: table-cell; @@ -234,14 +234,14 @@ } } - .tna-chip { - margin: 1rem 0; + .tna-chip-list { + margin-top: 1rem; - display: inline-block; + flex-wrap: nowrap; } .fa-solid { - margin-left: 0.5rem; + // margin-left: 0.5rem; &.light-icon { @include colour.colour-font("icon-light", true); diff --git a/src/nationalarchives/components/button/template.njk b/src/nationalarchives/components/button/template.njk index 1cd06f28..700f100c 100644 --- a/src/nationalarchives/components/button/template.njk +++ b/src/nationalarchives/components/button/template.njk @@ -18,10 +18,10 @@ {%- set buttonClasses = buttonClasses.concat('tna-button--icon-right') -%} {%- endif -%} <{{ 'button' if params.buttonElement else 'a' }}{%- if not params.buttonElement %} href="{{ params.href }}"{%- endif %} class="tna-button {{ buttonClasses | join(' ') }}"{%- if params.buttonElement %} type="{{ params.buttonType or 'button' }}"{% endif -%}{%- if params.title %} title="{{ params.title }}"{% endif %}{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}> - {%- if params.brandIcon %} + {%- if params.brandIcon -%} - {%- elseif params.icon %} + {% elseif params.icon -%} - {%- endif %} + {% endif -%} {{ params.text }} 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 7f4dd7b2..496a58e8 100644 --- a/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js +++ b/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js @@ -1395,9 +1395,19 @@ const CombinationsTemplate = () => { `${blockOutput}
-

Text / Dark / Light

+

Text / Dark / Light /

Link / Link (visited)

-

Chip

+
    +
  • + Chip +
  • +
  • + Chip +
  • +
  • + Chip +
  • +
${Button({ params: { diff --git a/src/nationalarchives/stories/utilities/lists/lists.stories.js b/src/nationalarchives/stories/utilities/lists/lists.stories.js index 3a90f424..43b6426c 100644 --- a/src/nationalarchives/stories/utilities/lists/lists.stories.js +++ b/src/nationalarchives/stories/utilities/lists/lists.stories.js @@ -129,3 +129,22 @@ ComplexDescriptionList.args = { { title: "Eta", description: ["Lorem ipsum 1", "Lorem ipsum 2"] }, ], }; + +const ChipListTemplate = ({ items }) => + `
    ${items.reduce( + (list, item) => `${list}
  • + + ${item.icon ? `` : ""} + ${item.text} + +
  • `, + "", + )}
`; +export const ChipList = ChipListTemplate.bind({}); +ChipList.args = { + items: [ + { text: "Alpha", icon: "heart" }, + { text: "Beta" }, + { text: "Gamma" }, + ], +}; diff --git a/src/nationalarchives/stories/utilities/typography/typography.mdx b/src/nationalarchives/stories/utilities/typography/typography.mdx index 6408ffc8..7a3f6d0a 100644 --- a/src/nationalarchives/stories/utilities/typography/typography.mdx +++ b/src/nationalarchives/stories/utilities/typography/typography.mdx @@ -15,7 +15,8 @@ import * as TypographyStories from './typography.stories'; ## Heading groups - + + ## General typography diff --git a/src/nationalarchives/utilities/_typography.scss b/src/nationalarchives/utilities/_typography.scss index ebfc363e..6c29b6b0 100644 --- a/src/nationalarchives/utilities/_typography.scss +++ b/src/nationalarchives/utilities/_typography.scss @@ -134,21 +134,30 @@ small { max-width: max-content; padding: 0.125em 0.25rem; - display: block; + display: flex; + align-items: center; + gap: 0.5rem; @include colour.colour-font("font-dark"); @include typography.detail-font-small; line-height: 1; - @include colour.accent; + &:not(#{&}--plain) { + @include colour.accent; - @include colour.colour-border("accent-background", 0.125rem); + @include colour.colour-border("accent-background", 0.125rem); + } .tna-background-accent &:not(#{&}--plain) { @include colour.plain; @include colour.colour-border("background"); } + + .fa-solid, + .fa-brand { + @include colour.colour-font("icon-light"); + } } .tna-chip { @@ -162,6 +171,11 @@ small { background-color: transparent; border: none; + + .fa-solid, + .fa-brand { + color: inherit; + } } @at-root #{selector.unify("a", &)} { @@ -206,42 +220,21 @@ small { gap: 0.5rem; } - .fa-solid, - .fa-brand { - @include colour.colour-font("icon-light"); - } - @include colour.on-high-contrast { - @include colour.colour-border("keyline-dark", 1px, solid); + .tna-chip:not(.tna-chip--plain) { + padding: 0.25rem 0.5rem; + + @include colour.colour-border("keyline-dark"); + } .fa-solid, .fa-brand { - padding: 0.375rem 0.25rem; + padding-right: 0.5rem; - @include colour.colour-font("contrast-font-base"); - - @include colour.colour-background("contrast-background"); + color: inherit; @include colour.colour-border("keyline-dark", 1px, solid, right); } - - .tna-chip { - &:has(.fa-solid, .fa-brand) { - padding-left: 0; - - .fa-solid, - .fa-brand { - margin-right: 0.5rem; - } - } - } - } - } - - &--accent { - .fa-solid, - .fa-brand { - @include colour.colour-font("accent-background"); } } }