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

Remove unnecessary duplicated use of govuk-font #4267

Merged
merged 3 commits into from
Oct 2, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ We’ve made fixes to GOV.UK Frontend in the following pull requests:
- [#3791: Refactor mobile menu button label/text handling](https://github.com/alphagov/govuk-frontend/pull/3791)
- [#3862: Fix focus style being overlapped by summary action links](https://github.com/alphagov/govuk-frontend/pull/3862)
- [#4113: Always set an explicit button `type`](https://github.com/alphagov/govuk-frontend/pull/4113)
- [#4267: Remove unnecessary duplicated use of govuk-font](https://github.com/alphagov/govuk-frontend/pull/4267)

## 4.7.0 (Feature release)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
$govuk-checkboxes-label-padding-left-right: govuk-spacing(3);

.govuk-checkboxes__item {
@include govuk-font($size: 19);

display: block;
position: relative;

Expand Down Expand Up @@ -141,9 +139,9 @@
// =========================================================

.govuk-checkboxes__divider {
$govuk-divider-size: $govuk-checkboxes-size !default;
@include govuk-font($size: 19);
@include govuk-text-colour;
$govuk-divider-size: $govuk-checkboxes-size !default;
width: $govuk-divider-size;
margin-bottom: govuk-spacing(2);
text-align: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

@include govuk-exports("govuk/component/error-summary") {
.govuk-error-summary {
@include govuk-font($size: 19);
colinrotherham marked this conversation as resolved.
Show resolved Hide resolved
@include govuk-text-colour;
@include govuk-responsive-padding(4);
@include govuk-responsive-margin(8, "bottom");
Expand All @@ -14,15 +15,14 @@
}

.govuk-error-summary__title {
@include govuk-font($size: 24, $weight: bold);
@include govuk-typography-responsive($size: 24);
@include govuk-typography-weight-bold;
owenatgov marked this conversation as resolved.
Show resolved Hide resolved

margin-top: 0;
@include govuk-responsive-margin(4, "bottom");
}

.govuk-error-summary__body {
@include govuk-font($size: 19);

p {
margin-top: 0;
@include govuk-responsive-margin(4, "bottom");
Expand Down
17 changes: 10 additions & 7 deletions packages/govuk-frontend/src/govuk/components/fieldset/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,27 @@
}

// Modifiers that make legends look more like their equivalent headings
.govuk-fieldset__legend--xl,
.govuk-fieldset__legend--l,
.govuk-fieldset__legend--m {
@include govuk-typography-weight-bold;
colinrotherham marked this conversation as resolved.
Show resolved Hide resolved
margin-bottom: govuk-spacing(3);
}
Comment on lines +38 to +43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉


.govuk-fieldset__legend--xl {
@include govuk-font($size: 48, $weight: bold);
margin-bottom: govuk-spacing(3);
@include govuk-typography-responsive($size: 48);
}

.govuk-fieldset__legend--l {
@include govuk-font($size: 36, $weight: bold);
margin-bottom: govuk-spacing(3);
@include govuk-typography-responsive($size: 36);
}

.govuk-fieldset__legend--m {
@include govuk-font($size: 24, $weight: bold);
margin-bottom: govuk-spacing(3);
@include govuk-typography-responsive($size: 24);
}

.govuk-fieldset__legend--s {
@include govuk-font($size: 19, $weight: bold);
@include govuk-typography-weight-bold;
colinrotherham marked this conversation as resolved.
Show resolved Hide resolved
}

// When the legend contains an H1, we want the H1 to inherit all styles from
Expand Down
13 changes: 7 additions & 6 deletions packages/govuk-frontend/src/govuk/components/header/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
}

.govuk-header__product-name {
@include govuk-font($size: 24, $line-height: 1);
@include govuk-typography-responsive($size: 24, $override-line-height: 1);
@include govuk-typography-weight-regular;
display: inline-table;
}

Expand All @@ -74,7 +75,6 @@
// - all links get a 3px underline regardless of text size, as there are
// multiple grouped elements close to one another and having slightly
// different underline widths looks unbalanced
@include govuk-typography-common;
@include govuk-link-style-inverse;

text-decoration: none;
Expand All @@ -96,8 +96,7 @@
.govuk-header__link--homepage {
// Font size needs to be set on the link so that the box sizing is correct
// in Firefox
@include govuk-font($size: false, $weight: bold);

@include govuk-typography-weight-bold;
display: inline-block;
margin-right: govuk-spacing(2);
font-size: 30px; // We don't have a mixin that produces 30px font size
Expand Down Expand Up @@ -135,7 +134,8 @@
.govuk-header__service-name {
display: inline-block;
margin-bottom: govuk-spacing(2);
@include govuk-font($size: 24, $weight: bold);
@include govuk-typography-responsive($size: 24);
@include govuk-typography-weight-bold;
}

.govuk-header__logo,
Expand Down Expand Up @@ -248,7 +248,8 @@
}

a {
@include govuk-font($size: 16, $weight: bold);
@include govuk-typography-responsive($size: 16);
@include govuk-typography-weight-bold;
white-space: nowrap;
}
}
Expand Down
17 changes: 10 additions & 7 deletions packages/govuk-frontend/src/govuk/components/label/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,27 @@
}

// Modifiers that make labels look more like their equivalent headings
.govuk-label--xl,
.govuk-label--l,
.govuk-label--m {
@include govuk-typography-weight-bold;
margin-bottom: govuk-spacing(3);
}

.govuk-label--xl {
@include govuk-font($size: 48, $weight: bold);
margin-bottom: govuk-spacing(3);
@include govuk-typography-responsive($size: 48);
}

.govuk-label--l {
@include govuk-font($size: 36, $weight: bold);
margin-bottom: govuk-spacing(3);
@include govuk-typography-responsive($size: 36);
}

.govuk-label--m {
@include govuk-font($size: 24, $weight: bold);
margin-bottom: govuk-spacing(2);
@include govuk-typography-responsive($size: 24);
}

.govuk-label--s {
@include govuk-font($size: 19, $weight: bold);
@include govuk-typography-weight-bold;
owenatgov marked this conversation as resolved.
Show resolved Hide resolved
}

// When the label is nested inside a heading, override the heading so that it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
}

.govuk-notification-banner__title {
@include govuk-font($size: 19, $weight: bold);

// Set the size again because this element is a heading and the user agent
// font size overrides the inherited font size
@include govuk-typography-responsive($size: 19);
@include govuk-typography-weight-bold;
margin: 0;

padding: 0;

color: govuk-colour("white");
}

Expand Down Expand Up @@ -65,7 +65,8 @@
}

.govuk-notification-banner__heading {
@include govuk-font($size: 24, $weight: bold);
@include govuk-typography-responsive($size: 24);
@include govuk-typography-weight-bold;

margin: 0 0 govuk-spacing(3) 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
}

.govuk-pagination__link-label {
@include govuk-font($size: 19, $weight: "regular");
@include govuk-typography-weight-regular;
@include govuk-link-decoration;
display: inline-block;
padding-left: govuk-spacing(6);
Expand Down
10 changes: 3 additions & 7 deletions packages/govuk-frontend/src/govuk/components/panel/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@include govuk-exports("govuk/component/panel") {
.govuk-panel {
@include govuk-font($size: 19);
@include govuk-font($size: 36);

box-sizing: border-box;

Expand Down Expand Up @@ -40,17 +40,13 @@
}

.govuk-panel__title {
@include govuk-typography-responsive($size: 48);
@include govuk-typography-weight-bold;
margin-top: 0;
margin-bottom: govuk-spacing(6);

@include govuk-font($size: 48, $weight: bold);
}

.govuk-panel__title:last-child {
margin-bottom: 0;
}

.govuk-panel__body {
@include govuk-font($size: 36);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

.govuk-phase-banner__content__tag {
@include govuk-font($size: 16);
@include govuk-typography-responsive($size: 16);
margin-right: govuk-spacing(2);

// When forced colour mode is active, for example to provide high contrast,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
$govuk-radios-focus-width: $govuk-focus-width + 1px;

.govuk-radios__item {
@include govuk-font($size: 19);

display: block;
position: relative;

Expand Down Expand Up @@ -157,9 +155,9 @@
// =========================================================

.govuk-radios__divider {
$govuk-divider-size: $govuk-radios-size !default;
@include govuk-font($size: 19);
@include govuk-text-colour;
$govuk-divider-size: $govuk-radios-size !default;
width: $govuk-divider-size;
margin-bottom: govuk-spacing(2);
text-align: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@

.govuk-summary-card__title {
@include govuk-font($size: 19, $weight: bold);
@include govuk-text-colour;
margin: govuk-spacing(1) govuk-spacing(4) govuk-spacing(2) 0;

@include govuk-media-query($from: "tablet") {
Expand All @@ -201,7 +202,8 @@
}

.govuk-summary-card__actions {
@include govuk-font($size: 19, $weight: bold);
@include govuk-typography-responsive($size: 19);
@include govuk-typography-weight-bold;
display: flex;
flex-wrap: wrap;
row-gap: 10px;
Expand Down
18 changes: 8 additions & 10 deletions packages/govuk-frontend/src/govuk/components/table/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,21 @@
}

// Modifiers that make captions look more like their equivalent headings
.govuk-table__caption--xl,
.govuk-table__caption--l,
.govuk-table__caption--m {
margin-bottom: govuk-spacing(3);
}
owenatgov marked this conversation as resolved.
Show resolved Hide resolved

.govuk-table__caption--xl {
@include govuk-font($size: 48, $weight: bold);
margin-bottom: govuk-spacing(3);
@include govuk-typography-responsive($size: 48);
}

.govuk-table__caption--l {
@include govuk-font($size: 36, $weight: bold);
margin-bottom: govuk-spacing(3);
@include govuk-typography-responsive($size: 36);
}

.govuk-table__caption--m {
@include govuk-font($size: 24, $weight: bold);
margin-bottom: govuk-spacing(3);
}

.govuk-table__caption--s {
@include govuk-font($size: 19, $weight: bold);
@include govuk-typography-responsive($size: 24);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ examples:
- name: table with head and caption
options:
caption: 'Caption 1: Months and rates'
captionClasses: govuk-heading-m
captionClasses: govuk-table__caption--m
firstCellIsHeader: true
head:
- text: Month you apply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Table', () => {
const $ = render('table', examples['table with head and caption'])
const $caption = $('.govuk-table__caption')

expect($caption.hasClass('govuk-heading-m')).toBeTruthy()
expect($caption.hasClass('govuk-table__caption--m')).toBeTruthy()
})
})

Expand Down
7 changes: 5 additions & 2 deletions packages/govuk-frontend/src/govuk/components/tabs/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
.govuk-tabs {
@include govuk-responsive-margin(1, "top");
@include govuk-responsive-margin(6, "bottom");
@include govuk-font($size: 19);
owenatgov marked this conversation as resolved.
Show resolved Hide resolved
}

.govuk-tabs__title {
@include govuk-font($size: 19);
// Set the size and weight again because this element is a heading and the
// user agent font size overrides the inherited font size
@include govuk-typography-responsive($size: 19);
@include govuk-typography-weight-regular;
@include govuk-text-colour;
margin-bottom: govuk-spacing(2);
}
Expand All @@ -18,7 +22,6 @@
}

.govuk-tabs__list-item {
@include govuk-font($size: 19);
margin-left: govuk-spacing(5);

&::before {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
@include govuk-exports("govuk/component/warning-text") {
.govuk-warning-text {
position: relative;
@include govuk-font($size: 19);
@include govuk-responsive-margin(6, "bottom");
position: relative;
padding: govuk-spacing(2) 0;
}

.govuk-warning-text__icon {
@include govuk-font($size: false, $weight: bold);

// We apply this here and not at the parent level because the actual text is
// a <strong> and so will always be bold
@include govuk-typography-weight-bold;
box-sizing: border-box;

display: inline-block;
Expand Down Expand Up @@ -52,7 +54,6 @@
}

.govuk-warning-text__text {
@include govuk-font($size: 19, $weight: bold);
@include govuk-text-colour;
display: block;
padding-left: 45px;
Expand Down