Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button icons, picture captions, headings #69

Merged
merged 3 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .storybook/storybook.scss
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@
flex-wrap: nowrap;
}

.tna-form__group-contents,
.tna-form__heading {
font-size: 0;
line-height: 0;
}

.tna-pagination {
margin-top: 1rem;
}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- The default cookie banner colour is dark on light but can be changed with a `style` attribute or classes such as `tna-cookie-banner--contrast`
- The card style of `boxed` has been changed to `contrast` in line with other components
- Changed `tna-select--plain` to `tna-select--styled`
- Updated button styles - icon sizes, padding and gaps on small and icon-only buttons
- Removed slash on void elements (updating `<hr />` to `<hr>`)
- Italicise picture element captions to distinguish from regular text
- Use `text-wrap: pretty;` for headings

### Deprecated
### Removed
Expand Down
16 changes: 9 additions & 7 deletions src/nationalarchives/all.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/*!
* ------------------------------------------------
* The National Archives Frontend
* https://github.com/nationalarchives/tna-frontend
* ------------------------------------------------
* ------------------------------------------
*
* TNA Frontend
* github.com/nationalarchives/tna-frontend
*
* Explore 1,000 years of history
* https://www.nationalarchives.gov.uk/
* ------------------------------------------------
* www.nationalarchives.gov.uk
*
* ------------------------------------------
* MIT Licence
* ------------------------------------------------
* ------------------------------------------
*/

@use "variables";
Expand Down
35 changes: 17 additions & 18 deletions src/nationalarchives/components/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
padding: 0.25rem 1rem;

display: inline-flex;
align-items: center;
align-items: baseline;
justify-content: center;
gap: 0.5rem;
gap: 0.75rem;

@include typography.relative-font-size(18);
@include typography.main-font-weight-bold;
line-height: #{math.div(16, 18) * 2};
text-decoration: none;
text-align: center;
line-height: #{math.div(16, 18) * 2};
text-wrap: balance;

@include colour.colour-background("button-background");
Expand All @@ -25,13 +26,6 @@

cursor: pointer;

&,
.fa-solid,
.fa-brands {
@include typography.relative-font-size(18);
line-height: #{math.div(16, 18) * 2};
}

&,
&:link,
&:visited {
Expand All @@ -45,6 +39,14 @@
background: transparent;
}

.fa-solid,
.fa-brands {
display: block;

font-size: 0.9em;
line-height: #{math.div(16, 18) * 2};
}

&--plain {
@include typography.main-font-weight;

Expand Down Expand Up @@ -83,13 +85,6 @@
flex-direction: row-reverse;
}

.fa-solid,
.fa-brands {
min-width: 1.25rem;

display: block;
}

&--small,
&-group--small & {
padding: 0 0.5rem;
Expand All @@ -99,7 +94,6 @@

.fa-solid,
.fa-brands {
@include typography.relative-font-size(18);
line-height: 2rem;
}
}
Expand All @@ -111,10 +105,13 @@
gap: 0;

font-size: 0;
line-height: 0;

.fa-solid,
.fa-brands {
width: 2.5rem;

@include typography.relative-font-size(18);
}
}

Expand All @@ -125,6 +122,8 @@
.fa-solid,
.fa-brands {
width: 2rem;

@include typography.relative-font-size(18 * 0.9);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/nationalarchives/components/footer/fixtures.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/nationalarchives/components/footer/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@
</li>
{%- endfor -%}
</ul>
<hr />
<hr>
</nav>
{%- else -%}
<div class="tna-column--full">
<hr />
<hr>
</div>
{%- endif -%}
</div>
Expand Down
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/picture/picture.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@
}

&__caption {
margin: 0 2rem;
margin: 0 1rem;
padding: 1rem;

@include typography.relative-font-size(16);
font-style: italic;

@include colour.colour-border("keyline", 1px, solid, bottom);
}
Expand Down Expand Up @@ -79,6 +80,14 @@
margin-right: 0;
margin-left: 0;
}

@if grid.$gutter-width-tiny != 1.5rem {
&__caption,
&__transcript {
padding-right: grid.$gutter-width-tiny;
padding-left: grid.$gutter-width-tiny;
}
}
}

@include colour.on-high-contrast-and-forced-colours {
Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@include colour.colour-border("input-border", forms.$form-field-border-width);
border-radius: 0;

&--plain {
&--styled {
padding: 0 2.5rem 0 0.75rem;

appearance: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ const Template = () => {
</ul>
${TextInput({
params: {
label: "Input",
id: `name-${theme}-${block}-${accent}`,
name: `name-${theme}-${block}-${accent}`,
value: `name-${theme}-${block}-${accent}`,
value: `Lorem ipsum`,
},
})}
${Checkboxes({
Expand Down Expand Up @@ -132,6 +133,7 @@ const Template = () => {
})}
${Select({
params: {
label: "Select",
id: `sort-${theme}-${block}-${accent}`,
name: `sort-${theme}-${block}-${accent}`,
items: [
Expand Down
7 changes: 6 additions & 1 deletion src/nationalarchives/templates/layouts/_generic.njk
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{# Based on https://github.com/alphagov/govuk-frontend/blob/8b6bf304b9fc891f64459c25a08f3d623f3fea72/packages/govuk-frontend/src/govuk/template.njk #}

{% from "nationalarchives/components/cookie-banner/macro.njk" import tnaCookieBanner -%}
{% from "nationalarchives/components/footer/macro.njk" import tnaFooter -%}
{% from "nationalarchives/components/header/macro.njk" import tnaHeader -%}
{% from "nationalarchives/components/skip-link/macro.njk" import tnaSkipLink -%}

{% set siteTitle = 'The National Archives' %}
{% set pageTitle = '' %}

<!DOCTYPE html>
<html lang="{{ htmlLang | default('en-GB') }}" class="tna-template tna-template--{{ theme | default('system') }}-theme tna-template--{{ themeAccent | default('black') }}-accent {{ htmlClasses }}">
<head>
<meta charset="utf-8">
<title>{% block pageTitle %}The National Archives{% endblock %}</title>
<title>{% block pageTitle %}{% if pageTitle %}{{ pageTitle }} - {{ siteTitle }}{% else %}{{ siteTitle }}{% endif %}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="theme-color" content="{{ themeColor | default('#000000') }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
13 changes: 6 additions & 7 deletions src/nationalarchives/utilities/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,12 @@ small {

%heading {
@include colour.colour-font("font-dark");
text-wrap: pretty;

&:not(.tna-heading--no-link-arrow) {
a {
display: inline-block;

// text-wrap: balance;

&::after {
padding-left: 0.25rem;

Expand All @@ -225,11 +224,11 @@ small {
content: "\203A";
}

// &:hover {
// &::after {
// padding-left: 0.5rem;
// }
// }
&:hover {
&::after {
padding-left: 0.5rem;
}
}
}
}
}
Expand Down