Skip to content

Commit

Permalink
WIP: Change headings markup
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Oct 19, 2023
1 parent 0d2291f commit 88566d3
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 64 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- External link icons changed from CSS to icon font in header and footer
- External links in footer have titles suffixed with "opens in new tab"
- Links in footer and text in buttons have balanced wrapping applied
- Header and header group class modifiers have been moved to separate blocks (`tna-heading tna-heading--xl` -> `tna-heading-xl`)

### Deprecated
### Removed
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/cookie-banner/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="tna-cookie-banner {{ containerClasses | join(' ') }}" role="region" aria-label="Cookie usage" data-module="tna-cookie-banner" data-policies="{{ params.policies if params.policies else 'usage,settings' }}" data-preferenceskey="{{ params.cookiesPreferencesSetKey if params.cookiesPreferencesSetKey else 'cookies_preferences_set' }}"{% if params.loadScriptsOnAccept %} data-acceptscripts="{{ params.loadScriptsOnAccept }}"{% endif %}{%- 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 tna-heading--m">This website uses cookies</h2>
<h2 class="tna-heading-m">This website uses cookies</h2>
<p>We use some essential cookies to make this service work.</p>
<p>We'd also like to use analytics cookies so we can understand how you use the service and make improvements.</p>
<div class="tna-button-group">
Expand Down
6 changes: 3 additions & 3 deletions src/nationalarchives/components/footer/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<path d="M21.3 19.5h-5.4v-3h14.3v3h-5.4v18.4h-3.5zM31.6 16.5H35v9h8.4v-9h3.4v21.4h-3.4v-9.3H35v9.3h-3.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archives</h2>
<h2 class="tna-heading-m tna-footer__title">The National Archives</h2>
<address class="tna-footer__address">
Kew, Richmond<br />
TW9 4DU
Expand Down Expand Up @@ -50,7 +50,7 @@
<div class="tna-footer__navigation tna-column {% if params.showNewsletter %}tna-column--width-1-2{% else %}tna-column--width-2-3{% endif %} tna-column--full-medium tna-column--full-small tna-column--full-tiny tna-column--order-2 tna-column--order-4-medium tna-columns tna-columns--2 tna-columns--1-tiny">
{%- for group in params.navigation -%}
<nav class="tna-footer__navigation-block tna-columns__block" role="navigation" aria-label="{{ group.title }}">
<h3 class="tna-footer__navigation-block-heading tna-heading tna-heading--m">
<h3 class="tna-footer__navigation-block-heading tna-heading-m">
{{ group.title }}
</h3>
<ul class="tna-footer__navigation-block-items tna-ul tna-ul--plain">
Expand All @@ -72,7 +72,7 @@
{%- if params.showNewsletter -%}
<div class="tna-column tna-column--width-1-4 tna-column--width-1-2-medium tna-column--full-small tna-column--full-tiny tna-column--order-3">
<div class="tna-footer__mailing-list">
<h3 class="tna-footer__navigation-block-heading tna-heading tna-heading--m">
<h3 class="tna-footer__navigation-block-heading tna-heading-m">
Join the National Archives' mailing list
</h3>
<p>
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/gallery/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
items: item.tabs
}) }}
{%- else -%}
<h{{ params.heading.level + 1 }} class="tna-heading tna-heading--m">
<h{{ params.heading.level + 1 }} class="tna-heading-m">
{{ item.tabs[0].title }}
</h{{ params.heading.level + 1 }}>
{{ item.tabs[0].body|safe }}
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/hero/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny tna-hero__content">
<div class="tna-hero__content-inner">
{%- if params.heading -%}
<h1 class="tna-heading tna-heading--xl tna-hero__heading">
<h1 class="tna-heading-xl tna-hero__heading">
{{ params.heading }}
</h1>
{%- endif -%}
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/profile/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img src="https://avatar.iran.liara.run/public/68" width="200" height="200" alt="Photo of Max Smith" />
</div>
<div class="tna-column tna-column--flex-1 tna-column--full-small tna-column--full-tiny tna-column--order-1 tna-column--order-3-small tna-column--order-3-tiny">
<hgroup class="tna-hgroup tna-hgroup--xl">
<hgroup class="tna-hgroup-xl">
<p class="tna-hgroup__supertitle">Profile</p>
<h1 class="tna-hgroup__title tna-heading">Max Smith</h1>
</hgroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const Template = ({ theme, accent }) => {
})}
<div class="tna-container tna-section">
<div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny">
<hgroup class="tna-hgroup tna-hgroup--l">
<hgroup class="tna-hgroup-l">
<p class="tna-hgroup__supertitle">TNA colour theme</p>
<h2 class="tna-hgroup__title">Heading</h2>
</hgroup>
Expand Down Expand Up @@ -269,38 +269,38 @@ const Template = ({ theme, accent }) => {
<hr>
<div class="tna-container tna-section">
<div class="tna-column tna-column--full">
<h1 class="tna-heading tna-heading--xl">
<h1 class="tna-heading-xl">
This is a heading (XL)
</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh.</p>
<h2 class="tna-heading tna-heading--l">
<h2 class="tna-heading-l">
This is a heading (L)
</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh.</p>
<h3 class="tna-heading tna-heading--m">
<h3 class="tna-heading-m">
This is a heading (M)
</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh.</p>
<h4 class="tna-heading tna-heading--s">
<h4 class="tna-heading-s">
This is a heading (S)
</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh.</p>
<hgroup class="tna-hgroup tna-hgroup--xl">
<hgroup class="tna-hgroup-xl">
<p class="tna-hgroup__supertitle">Supertitle</p>
<h2 class="tna-hgroup__title">This is a heading (XL)</h2>
</hgroup>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh.</p>
<hgroup class="tna-hgroup tna-hgroup--l">
<hgroup class="tna-hgroup-l">
<p class="tna-hgroup__supertitle">Supertitle</p>
<h2 class="tna-hgroup__title">This is a heading (L)</h2>
</hgroup>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh.</p>
<hgroup class="tna-hgroup tna-hgroup--m">
<hgroup class="tna-hgroup-m">
<p class="tna-hgroup__supertitle">Supertitle</p>
<h2 class="tna-hgroup__title">This is a heading (M)</h2>
</hgroup>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel tincidunt velit, a molestie turpis. Sed odio libero, sodales eleifend lorem sit amet, feugiat consequat nibh.</p>
<hgroup class="tna-hgroup tna-hgroup--s">
<hgroup class="tna-hgroup-s">
<p class="tna-hgroup__supertitle">Supertitle</p>
<h2 class="tna-hgroup__title">This is a heading (S)</h2>
</hgroup>
Expand All @@ -314,7 +314,7 @@ const Template = ({ theme, accent }) => {
</div>
<p class="tna-blockquote__author">Douglas Adams, Mostly Harmless</p>
</blockquote>
<h2 class="tna-heading tna-heading--m">
<h2 class="tna-heading-m">
<a href="#">Reaerching with The National Archives</a>
</h2>
<p>Lorem ipsum <a href="#">link</a></p>
Expand All @@ -327,7 +327,7 @@ const Template = ({ theme, accent }) => {
<p>Lorem ipsum <a href="#">link</a></p>
</div>
<div class="tna-column tna-column--width-1-2 tna-column--full-small tna-column--full-tiny tna-!--margin-top-m">
<h3 class="tna-heading tna-heading--m">
<h3 class="tna-heading-m">
Descriptions
</h3>
<dl class="tna-dl">
Expand All @@ -340,7 +340,7 @@ const Template = ({ theme, accent }) => {
</dl>
</div>
<div class="tna-column tna-column--width-1-2 tna-column--full-small tna-column--full-tiny tna-!--margin-top-m">
<h3 class="tna-heading tna-heading--m">
<h3 class="tna-heading-m">
Descriptions
</h3>
<dl class="tna-dl tna-dl--plain">
Expand All @@ -353,7 +353,7 @@ const Template = ({ theme, accent }) => {
</dl>
</div>
<div class="tna-column tna-column--full tna-!--margin-top-m">
<h3 class="tna-heading tna-heading--m">
<h3 class="tna-heading-m">
Descriptions
</h3>
<dl class="tna-dl tna-dl--icon-padding ">
Expand All @@ -373,7 +373,7 @@ const Template = ({ theme, accent }) => {
</dt>
<dd>LC 4</dd>
</dl>
<h2 class="tna-heading tna-heading--l">
<h2 class="tna-heading-l">
Categories
</h2>
<ul class="tna-chip-list">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const Template = ({
singleSentence,
}) =>
singleSentence
? `<hgroup class="tna-hgroup tna-hgroup--${size}">
? `<hgroup class="tna-hgroup-${size}">
<h${level} class="tna-hgroup__title">
<span class="tna-hgroup__supertitle">${supertitle}</span>
<span class="tna-hgroup__title">${title}</span>
</h${level}>
</hgroup>`
: `<hgroup class="tna-hgroup tna-hgroup--${size}">
: `<hgroup class="tna-hgroup-${size}">
<p class="tna-hgroup__supertitle">${supertitle}</p>
<h${level} class="tna-hgroup__title">${title}</h${level}>
</hgroup>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export default {
argTypes,
};

const HeadingTemplate = ({ params }, level) => `<h${level} class="tna-heading${
params.size ? ` tna-heading--${params.size}` : ""
}">
const HeadingTemplate = ({ params }, level) => `<h${level} class="tna-heading-${params.size}">
${params.text} (${params.size.toUpperCase()})
</h${level}>
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Paragraph.args = {
};

const HeadingLinkTemplate = ({ text, href }) =>
`<h2 class="tna-heading tna-heading--s">
`<h2 class="tna-heading-s">
<a href="${href}">${text}</a>
</h2>`;
export const HeadingLink = HeadingLinkTemplate.bind({});
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/templates/homepage.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="tna-section">
<div class="tna-container">
<div class="tna-column tna-column--full">
<h1 class="tna-heading tna-heading--xl">
<h1 class="tna-heading-xl">
Welcome
</h1>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/templates/search-results.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<main class="tna-main-wrapper tna-column tna-column--container tna-column--3-4 tna-column--width-2-3-medium tna-column--full-small tna-column--full-tiny {{ mainClasses }}" id="main-content" role="main"{% if mainLang %} lang="{{ mainLang }}"{% endif %}>
{% block beforeContent %}{% endblock %}
<div class="tna-column tna-column--full">
<h1 class="tna-heading tna-heading--xl">
<h1 class="tna-heading-xl">
Search results for "foobar"
</h1>
</div>
Expand Down
80 changes: 45 additions & 35 deletions src/nationalarchives/utilities/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ strong {
p {
margin: 0 0 1rem;

@include media.on-tiny {
margin-bottom: 1rem;
// @include media.on-tiny {
// margin-bottom: 1rem;
// }

+ *:not(p, ul, ol) {
margin-top: 2rem;
}

&:last-child {
Expand Down Expand Up @@ -124,8 +128,8 @@ small {

.tna-ul,
.tna-ol {
margin-top: 0;
margin-right: 0;
// margin-top: 0;
// margin-right: 0;
margin-left: 0;
padding: 0 0 0 2rem;

Expand Down Expand Up @@ -331,6 +335,8 @@ small {
}

%heading {
@extend %headings-and-heading-groups;

@include colour.colour-font("font-dark");

text-wrap: balance;
Expand Down Expand Up @@ -359,6 +365,8 @@ small {
}

%heading-xl {
@extend %heading;

@include typography.heading-font;
@include typography.relative-font-size(64);
line-height: 1.2;
Expand All @@ -373,6 +381,8 @@ small {
}

%heading-l {
@extend %heading;

@include typography.heading-font;
@include typography.relative-font-size(32);
line-height: 1.3;
Expand All @@ -387,38 +397,59 @@ small {
}

%heading-m {
@extend %heading;

@include typography.main-font-weight-bold;
@include typography.relative-font-size(22);
line-height: 1.6;

@include media.on-mobile {
@include typography.relative-font-size(20);
}
}

%heading-s {
@extend %heading;

@include typography.main-font-weight-bold;
@include typography.relative-font-size(18);
line-height: 1.6;
}

.tna-heading {
@extend %heading;
%headings-and-heading-groups {
margin-top: 3rem;
margin-bottom: 1rem;

&:first-child {
margin-top: 0;
}

&--xl {
&:last-child {
margin-bottom: 0;
}
}

.tna-heading {
&-xl {
@extend %heading-xl;
}

&--l {
&-l {
@extend %heading-l;
}

&--m {
&-m {
@extend %heading-m;
}

&--s {
&-s {
@extend %heading-s;
}
}

.tna-hgroup {
@extend %headings-and-heading-groups;

&__supertitle {
margin: 0 0 0.25rem;

Expand All @@ -429,46 +460,25 @@ small {
margin: 0;

display: block;

@extend %heading;
}

&--xl &__title {
&-xl &__title {
@extend %heading-xl;
}

&--l &__title {
&-l &__title {
@extend %heading-l;
}

&--m &__title {
&-m &__title {
@extend %heading-m;
}

&--s &__title {
&-s &__title {
@extend %heading-s;
}
}

.tna-heading,
.tna-hgroup {
margin-top: 3rem;
margin-bottom: 1rem;

// &--m,
// &--s {
// margin-bottom: 0.5rem;
// }

&:first-child {
margin-top: 0;
}

&:last-child {
margin-bottom: 0;
}
}

.tna-blockquote {
margin-top: 0;
margin-right: 0;
Expand Down

0 comments on commit 88566d3

Please sign in to comment.