Skip to content

Commit fcfad93

Browse files
Merge pull request #1308 from nhsuk/deprecate-mixins-functions
Deprecate remaining utility mixins/functions
2 parents 8df1221 + baed139 commit fcfad93

File tree

33 files changed

+395
-145
lines changed

33 files changed

+395
-145
lines changed

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,63 @@
22

33
## Unreleased
44

5+
:wastebasket: **Deprecated features**
6+
7+
#### Add nhsuk namespace to Sass mixins and functions
8+
9+
We've completed changes to prefix all Sass mixins and functions with the `nhsuk` namespace. You can still use the previous names but we'll remove them in a future breaking release.
10+
11+
**Sass mixins**
12+
13+
The following mixins have been renamed:
14+
15+
- `care-card` renamed to `nhsuk-care-card`
16+
- `clearfix` renamed to `nhsuk-clearfix`
17+
- `flex` renamed to `nhsuk-flex`
18+
- `flex-item` renamed to `nhsuk-flex-item`
19+
- `heading-label` renamed to `nhsuk-heading-label`
20+
- `panel` renamed to `nhsuk-panel`
21+
- `panel-with-label` renamed to `nhsuk-panel-with-label`
22+
- `print-color` renamed to `nhsuk-print-color`
23+
- `print-hide` renamed to `nhsuk-print-hide`
24+
- `reading-width` renamed to `nhsuk-reading-width`
25+
- `remove-margin-mobile` renamed to `nhsuk-remove-margin-mobile`
26+
- `top-and-bottom` renamed to `nhsuk-top-and-bottom`
27+
- `visually-hidden` renamed to `nhsuk-visually-hidden`
28+
- `visually-hidden-focusable` renamed to `nhsuk-visually-hidden-focusable`
29+
30+
Except for `visually-shown` which will be removed entirely. You must selectively apply `nhsuk-visually-hidden` using media queries instead.
31+
32+
Before:
33+
34+
```scss
35+
// Hide by default
36+
@include visually-hidden;
37+
38+
// Show from desktop
39+
@include nhsuk-media-query($from: desktop) {
40+
@include visually-shown;
41+
}
42+
```
43+
44+
After:
45+
46+
```scss
47+
// Hide until desktop only
48+
@include nhsuk-media-query($until: desktop) {
49+
@include nhsuk-visually-hidden;
50+
}
51+
```
52+
53+
See https://github.com/nhsuk/nhsuk-frontend/issues/1168 for more details.
54+
55+
**Sass functions**
56+
57+
The following functions have been renamed:
58+
59+
- `tint` renamed to `nhsuk-tint`
60+
- `shade` renamed to `nhsuk-shade`
61+
562
:wrench: **Fixes**
663

764
We've made fixes to NHS.UK frontend in the following pull requests:

docs/contributing/linting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Bad:
161161
Good:
162162

163163
```scss
164-
@include clearfix;
164+
@include nhsuk-clearfix;
165165
```
166166

167167
### Allow max 3-rule property shorthand if possible

packages/components/action-link/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
top: -3px;
6666
width: 36px;
6767

68-
@include print-color($nhsuk-print-text-color);
68+
@include nhsuk-print-color($nhsuk-print-text-color);
6969

7070
@include nhsuk-media-query($until: tablet) {
7171
height: 24px;

packages/components/breadcrumb/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
.nhsuk-breadcrumb {
1818
margin-top: nhsuk-spacing(3);
19-
@include print-hide; // [1]
19+
@include nhsuk-print-hide; // [1]
2020

2121
@include nhsuk-media-query($from: tablet) {
2222
margin-top: nhsuk-spacing(4);

packages/components/card/_index.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ $card-border-hover-color: $color_nhsuk-grey-3;
4848
display: block;
4949
width: 100%;
5050

51-
@include print-hide;
51+
@include nhsuk-print-hide;
5252
}
5353

5454
.nhsuk-card__content {
55-
@include top-and-bottom;
55+
@include nhsuk-top-and-bottom;
5656
@include nhsuk-responsive-padding(5);
5757
}
5858

@@ -96,7 +96,7 @@ $card-border-hover-color: $color_nhsuk-grey-3;
9696
margin-bottom: nhsuk-spacing(3);
9797
padding: 0;
9898

99-
@include flex;
99+
@include nhsuk-flex;
100100

101101
@include nhsuk-media-query($until: desktop) {
102102
margin-bottom: nhsuk-spacing(6);
@@ -114,7 +114,7 @@ $card-border-hover-color: $color_nhsuk-grey-3;
114114
list-style-type: none;
115115
margin-bottom: 0;
116116

117-
@include flex-item;
117+
@include nhsuk-flex-item;
118118

119119
.nhsuk-card {
120120
margin-bottom: nhsuk-spacing(5);
@@ -164,7 +164,7 @@ $card-border-hover-color: $color_nhsuk-grey-3;
164164
/// Care card
165165

166166
.nhsuk-card--care {
167-
@include care-card($color_nhsuk-blue, $color_nhsuk-white, 4px); // [8]
167+
@include nhsuk-care-card($color_nhsuk-blue, $color_nhsuk-white, 4px); // [8]
168168
@include nhsuk-responsive-margin(7, "top");
169169
}
170170

@@ -182,7 +182,7 @@ $card-border-hover-color: $color_nhsuk-grey-3;
182182
padding-top: 0; // [13]
183183

184184
@include nhsuk-font(26, $weight: bold);
185-
@include print-color($nhsuk-print-text-color);
185+
@include nhsuk-print-color($nhsuk-print-text-color);
186186
}
187187

188188
.nhsuk-card--care__arrow {
@@ -194,7 +194,7 @@ $card-border-hover-color: $color_nhsuk-grey-3;
194194
position: absolute;
195195
transform: rotate(45deg);
196196
width: 20px; // [9]
197-
@include print-hide;
197+
@include nhsuk-print-hide;
198198

199199
@include nhsuk-media-query($from: tablet) {
200200
left: 38px; // [10]
@@ -214,7 +214,7 @@ $card-border-hover-color: $color_nhsuk-grey-3;
214214
}
215215

216216
.nhsuk-card--care--urgent {
217-
@include care-card($color_nhsuk-red, $color_nhsuk-white, 6px);
217+
@include nhsuk-care-card($color_nhsuk-red, $color_nhsuk-white, 6px);
218218

219219
.nhsuk-card--care__arrow {
220220
&::before,
@@ -225,7 +225,7 @@ $card-border-hover-color: $color_nhsuk-grey-3;
225225
}
226226

227227
.nhsuk-card--care--emergency {
228-
@include care-card($color_nhsuk-red, $color_nhsuk-white, 8px);
228+
@include nhsuk-care-card($color_nhsuk-red, $color_nhsuk-white, 8px);
229229

230230
.nhsuk-card--care__arrow {
231231
&::before,

packages/components/date-input/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.nhsuk-date-input {
1212
font-size: 0; // [1]
1313

14-
@include clearfix;
14+
@include nhsuk-clearfix;
1515
}
1616

1717
.nhsuk-date-input__item {

packages/components/details/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
margin-top: nhsuk-spacing(2);
8080
padding: nhsuk-spacing(3);
8181
padding-left: 20px; // [6]
82-
@include top-and-bottom;
82+
@include nhsuk-top-and-bottom;
8383
}
8484

8585
/// Expander variation.

packages/components/do-dont-list/_index.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
////
1515

1616
.nhsuk-do-dont-list {
17-
@include panel-with-label($color_nhsuk-white, $nhsuk-text-color, $color_nhsuk-grey-4); // [1]
17+
@include nhsuk-panel-with-label($color_nhsuk-white, $nhsuk-text-color, $color_nhsuk-grey-4); // [1]
1818
}
1919

2020
.nhsuk-do-dont-list__label {
21-
@include heading-label($color_nhsuk-blue, $color_nhsuk-white); // [2]
22-
@include print-color($nhsuk-print-text-color);
21+
@include nhsuk-heading-label($color_nhsuk-blue, $color_nhsuk-white); // [2]
22+
@include nhsuk-print-color($nhsuk-print-text-color);
2323
}

packages/components/fieldset/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
margin: 0;
2020
padding: 0;
2121

22-
@include clearfix;
22+
@include nhsuk-clearfix;
2323
}
2424

2525
.nhsuk-fieldset__legend {

packages/components/footer/_index.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
background-color: $color_nhsuk-grey-4;
1313
border-top: nhsuk-spacing(1) solid $color_nhsuk-blue;
1414

15-
@include clearfix;
16-
@include print-hide;
15+
@include nhsuk-clearfix;
16+
@include nhsuk-print-hide;
1717
@include nhsuk-responsive-padding(5, bottom);
1818
@include nhsuk-responsive-padding(5, top);
1919
}

0 commit comments

Comments
 (0)