-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy path_tables.scss
More file actions
164 lines (132 loc) · 3.47 KB
/
Copy path_tables.scss
File metadata and controls
164 lines (132 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
////
/// Table component
///
/// @group components
////
/// Table container is used to ensure the table does not break the container.
///
/// 1. Margin is removed so there isn't double spacing.
/// 2. XS size not added because it matches the table header, so it'd be bad for hierarchy
.nhsuk-table-container {
@include nhsuk-responsive-margin(7, "bottom");
display: block;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
overflow-x: auto;
width: 100%;
.nhsuk-table {
margin: 0; // [1]
}
}
.nhsuk-table__caption--xl {
@include nhsuk-typography-responsive(48);
}
.nhsuk-table__caption--l {
@include nhsuk-typography-responsive(36);
}
.nhsuk-table__caption--m {
@include nhsuk-typography-responsive(26);
}
.nhsuk-table__caption--s {
@include nhsuk-typography-responsive(22);
}
// [2]
/// Table row hover
///
/// Table row hover is used to aid readability for users.
.nhsuk-table__row {
&:hover {
background-color: $color_nhsuk-grey-5;
}
}
/// Table panel with tab heading
///
/// 1. Margin is removed so there isn't double spacing.
.nhsuk-table__panel-with-heading-tab {
@include panel-with-label($color_nhsuk-white, $nhsuk-text-color, $color_nhsuk-grey-4);
.nhsuk-table-container,
.nhsuk-table {
margin: 0; // [1]
}
}
.nhsuk-table__heading-tab {
@include heading-label($color_nhsuk-blue, $color_nhsuk-white);
}
/// Responsive table
///
/// 1. Hide the thead until desktop
/// 2. Removing default screen reader behaviour
/// 3. Assigning role of table-row on desktop to give default screen reader behaviour
/// 4. Using justify content to space out elements in the row on mobile
/// 5. Assigning a minimum width in case of black cell
/// 6. Aligning content to the right on mobile
/// 7. Aligning mobile header to left to split it from the data
/// 8. Hiding mobile specific header from desktop view
/// 9. Adding a display block value due to IE 11 not having full flex support
.nhsuk-table-responsive {
margin-bottom: 0;
width: 100%;
thead {
@include mq($until: desktop) {
@include visually-hidden; // [1]
}
}
.nhsuk-table__body {
.nhsuk-table-responsive__heading {
font-weight: $nhsuk-font-bold;
padding-right: nhsuk-spacing(3);
text-align: left; // [8]
}
.nhsuk-table__row {
display: block; // [3]
margin-bottom: nhsuk-spacing(4);
&:last-child {
margin-bottom: 0;
}
}
.nhsuk-table__row th {
text-align: right;
}
.nhsuk-table__row td {
display: block; // For browsers that don't support flexbox
display: flex;
justify-content: space-between; // [5]
min-width: 1px; // [6]
}
@media all and (-ms-high-contrast: none) {
.nhsuk-table__row td {
display: block; // [10]
}
}
@include mq($until: desktop) {
.nhsuk-table__row td {
padding-right: 0;
text-align: right; // [7]
&:last-child {
border-bottom: 3px solid $color_nhsuk-grey-4;
}
}
}
@include mq($from: desktop) {
.nhsuk-table-responsive__heading {
display: none; // [9]
}
.nhsuk-table__row {
display: table-row; // [4]
}
.nhsuk-table__row th {
text-align: left;
}
.nhsuk-table__row td {
display: table-cell;
}
}
}
}
/// Numeric tables
///
/// Right aligns table cells for numeric tables.
.nhsuk-table__header--numeric,
.nhsuk-table__cell--numeric {
text-align: right;
}