Skip to content

Commit 862873e

Browse files
committed
Deprecate .nhsuk-table-responsive
1 parent c4209ed commit 862873e

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ You can now reduce the vertical padding of table cells by setting `compact: true
206206
}) }}
207207
```
208208

209-
If you are not using Nunjucks macros, add the `nhsuk-table--compact` class to your table, or `nhsuk-table-responsive--compact` to a responsive table.
209+
If you are not using Nunjucks macros, add the `nhsuk-table--compact` class to your table, or `nhsuk-table-responsive--compact` to a responsive table. Note the class `nhsuk-table-responsive--compact` is deprecated, see below for details.
210210

211-
### :wastebasket: **Deprecated features**
211+
This change was introduced in [pull request #1998: Add compact option for tables](https://github.com/nhsuk/nhsuk-frontend/pull/1998).
212212

213213
#### Rename checkboxes "none" options
214214

@@ -303,6 +303,18 @@ The previous names are deprecated and will be removed in a future release.
303303

304304
This change was introduced in [pull request #1962: Add code and monospace font utilities](https://github.com/nhsuk/nhsuk-frontend/pull/1962).
305305

306+
#### Replace `nhsuk-table-responsive` CSS class
307+
308+
The `nhsuk-table-responsive` class is deprecated and will be removed in a future major release. Use `nhsuk-table--responsive` instead.
309+
310+
If you use the Nunjucks `table` macro with `responsive: true`, this is handled automatically.
311+
312+
If you use HTML, replace `nhsuk-table-responsive` with `nhsuk-table nhsuk-table--responsive`.
313+
314+
The `nhsuk-table-responsive--reverse` and `nhsuk-table-responsive--compact` modifier classes are also deprecated. Use `nhsuk-table--reverse` and `nhsuk-table--compact` instead.
315+
316+
This change was introduced in [pull request #1998: Add compact option for tables](https://github.com/nhsuk/nhsuk-frontend/pull/1998).
317+
306318
### :wrench: **Fixes**
307319

308320
In [pull request #1962: Add code and monospace font utilities](https://github.com/nhsuk/nhsuk-frontend/pull/1962) we've added missing Sass mixins and HTML classes. You can now style codes and sequences (such as NHS numbers) by adding the `nhsuk-u-font-code` HTML class, or by including the Sass mixin for custom components:

packages/nhsuk-frontend/src/nhsuk/components/tables/_index.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
}
3535

3636
.nhsuk-table,
37+
// Deprecated, to be removed in v11.0
3738
.nhsuk-table-responsive {
3839
box-sizing: border-box;
3940
width: 100%;
@@ -45,6 +46,7 @@
4546
}
4647

4748
.nhsuk-table--reverse,
49+
// Deprecated, to be removed in v11.0
4850
.nhsuk-table-responsive--reverse {
4951
color: $nhsuk-reverse-text-colour;
5052

@@ -55,6 +57,7 @@
5557
}
5658

5759
.nhsuk-table--compact,
60+
// Deprecated, to be removed in v11.0
5861
.nhsuk-table-responsive--compact {
5962
th,
6063
td {
@@ -103,6 +106,7 @@
103106

104107
.nhsuk-table,
105108
.nhsuk-table-container,
109+
// Deprecated, to be removed in v11.0
106110
.nhsuk-table-responsive {
107111
margin: 0; // [1]
108112
}
@@ -125,7 +129,9 @@
125129
// 8. Hiding mobile specific header from desktop view
126130
// 9. Adding a display block value due to IE 11 not having full flex support
127131

128-
.nhsuk-table-responsive {
132+
// Deprecated, to be removed in v11.0
133+
.nhsuk-table-responsive,
134+
.nhsuk-table--responsive {
129135
thead {
130136
@media #{nhsuk-until-breakpoint(desktop)} {
131137
@include nhsuk-visually-hidden; // [1]

packages/nhsuk-frontend/src/nhsuk/components/tables/template.njk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- set variant = params.variant -%}
66

77
{#- Set classes for this component #}
8-
{%- set classNames = "nhsuk-table" if not params.responsive else "nhsuk-table-responsive" -%}
8+
{%- set classNames = "nhsuk-table" if not params.responsive else "nhsuk-table nhsuk-table--responsive" -%}
99
{%- set classNamesCaption = "nhsuk-table__caption" -%}
1010

1111
{%- if variant == "reverse" and (
@@ -14,7 +14,7 @@
1414
not "nhsuk-table-responsive--reverse" in params.classes
1515
)
1616
) %}
17-
{% set classNames = classNames ~ (" nhsuk-table--" ~ variant if not params.responsive else " nhsuk-table-responsive--" ~ variant) %}
17+
{% set classNames = classNames ~ " nhsuk-table--" ~ variant %}
1818
{% endif %}
1919

2020
{%- if params.compact and (
@@ -23,7 +23,7 @@
2323
not "nhsuk-table-responsive--compact" in params.classes
2424
)
2525
) %}
26-
{% set classNames = classNames ~ (" nhsuk-table--compact" if not params.responsive else " nhsuk-table-responsive--compact") %}
26+
{% set classNames = classNames ~ " nhsuk-table--compact" %}
2727
{% endif %}
2828

2929
{%- if params.captionSize and

0 commit comments

Comments
 (0)