/
elements-page.scss
380 lines (301 loc) · 6.78 KB
/
elements-page.scss
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
@import "main";
// ==========================================================================
// Elements page styles
// ==========================================================================
// These are example styles, used only for the elements pages
// Set a max-width for scoped text elements
.text {
ul,
ol {
// Aim for less than 75 characters per line of text
max-width: 30em;
}
}
.elements-index {
// Reduce top and bottom margins
.heading-medium {
margin: 1em 0 0 0;
}
// Add spacing above
.divider {
margin-top: 4em;
}
}
// Increase spacing above headings
.heading-xlarge {
@include media(tablet) {
margin-top: em(60, 48);
margin-bottom: em(30, 48);
}
}
// Page contents
.heading-contents {
margin-top: 3em;
}
.list-contents li {
@include core-16;
}
// Use for paragraphs before lists
.lead-in {
margin-bottom: 0;
}
// Lists
.list-bullet {
margin-bottom: ($gutter*1.5);
}
// Example boxes
// ==========================================================================
.example {
@extend %contain-floats;
position: relative;
overflow: hidden;
border: 1px solid $grey-2;
margin-top: $gutter-half;
margin-bottom: $gutter-half;
padding-top: $gutter;
padding-right: $gutter-half;
padding-bottom: $gutter-half;
padding-left: $gutter-half;
@include media(tablet) {
padding-top: $gutter*1.5;
padding-right: $gutter;
padding-bottom: $gutter;
padding-left: $gutter;
}
&:before {
content: "EXAMPLE";
position: absolute;
top: 0;
left: 0;
padding: em(4) em(15) em(4) em(15);
@include core-14;
background: $grey-2;
color: white;
}
// Blue text for heading sizes
.highlight {
font-style: normal;
color: $hm-government;
}
// Fix grid layout within example boxes for IE7 and below
// where box-sizing isn't supported: http://caniuse.com/#search=box-sizing
@mixin example-box-column($width) {
width: (($site-width - $gutter) * $width) - $gutter;
}
@include ie-lte(7){
// Set example box width to 900px (removing left and right padding)
$example-box-width: $site-width - ($gutter * 2);
width: $example-box-width;
// Recalculate grid column widths
.column-quarter {
@include example-box-column( 1/4 );
}
.column-half {
@include example-box-column( 1/2 );
}
.column-third {
@include example-box-column( 1/3 );
}
.column-two-thirds {
@include example-box-column( 2/3 );
}
// Scale images to fit grid columns
img {
width: 100%;
}
}
}
// 1. Layout
// ==========================================================================
.example-grid p {
width: 100%;
background: file-url("examples/grid.png") 0 0 repeat;
margin-bottom: 0;
height: 30px;
@include media(tablet) {
height: 60px;
}
overflow: hidden;
text-indent: -999em;
}
// 2. Typography
// ==========================================================================
// 3. Colour
// ==========================================================================
// Colour swatches
.swatch {
width: 60px;
height: 60px;
@include border-radius(100%);
@include media(mobile) {
clear: both;
float: left;
margin-right: $gutter-half;
margin-bottom: $gutter-half;
}
@include media(tablet) {
margin: 0 auto $gutter-half auto;
}
}
// Sass list for colour palette
$palette: (
("purple", $purple),
("mauve", $mauve),
("fuschia", $fuschia),
("pink", $pink),
("baby-pink", $baby-pink),
("red", $red),
("mellow-red", $mellow-red),
("orange", $orange),
("brown", $brown),
("yellow", $yellow),
("green", $green),
("grass-green", $grass-green),
("turquoise", $turquoise),
("light-blue", $light-blue),
("govuk-blue", $govuk-blue)
);
@mixin color-swatches {
@each $color in $palette {
$color-name: nth($color, 1);
$color-var: nth($color, 2);
.swatch-#{$color-name} {
background-color: $color-var;
}
}
}
// Generate swatch classes for each colour in palette list
@include color-swatches;
.swatch-alpha {
background-color: $alpha-colour;
}
.swatch-beta {
background-color: $beta-colour;
}
.swatch-discovery {
background-color: $discovery-colour;
}
.swatch-live {
background-color: $live-colour;
}
.swatch-error {
background-color: $error-colour;
}
.swatch-focus {
background-color: $focus-colour;
}
.swatch-button-colour {
background-color: $button-colour;
}
.swatch-black {
background-color: $black;
}
.swatch-grey-1 {
background-color: $grey-1;
}
.swatch-grey-2 {
background-color: $grey-2;
}
.swatch-grey-3 {
background-color: $grey-3;
}
.swatch-grey-4 {
background-color: $grey-4;
}
.swatch-white {
background-color: $white;
border: 1px solid $grey-3;
}
.swatch-text-colour {
background-color: $text-colour;
}
.swatch-text-secondary {
background-color: $secondary-text-colour;
}
.swatch-page-colour {
background-color: $page-colour;
border: 1px solid $grey-3;
}
.swatch-button-colour {
background-color: $button-colour;
}
.swatch-link-colour {
background-color: $link-colour;
}
.swatch-link-colour-visited {
background-color: $link-visited-colour;
}
.swatch-link-colour-hover {
background-color: $link-hover-colour;
}
.swatch-border-colour {
background-color: $border-colour;
}
.swatch-panel-colour {
background-color: $panel-colour;
}
.swatch-highlight-colour {
background-color: $highlight-colour;
}
// Colour swatch layout
.swatch-wrapper {
@include media(tablet) {
float: left;
width: 20%;
text-align: center;
}
.heading-small {
margin-bottom: em(10);
}
ul {
padding-bottom: $gutter-half;
@include media(mobile) {
min-height: 50px;
padding-top: 10px;
}
}
li {
@include core-16;
}
b {
font-weight: bold;
text-transform: uppercase;
}
}
// 4. Images and icons
// ==========================================================================
.example-images img {
max-width: 100%;
vertical-align: top;
}
// 5. Data
// ==========================================================================
.data .bold-xlarge,
.data .bold-xxlarge {
line-height: 0.8;
}
.example .data p {
margin-bottom: 0;
}
// 6. Forms
// ==========================================================================
// 7. Buttons
// ==========================================================================
// Remove top margin from headings in the "Creating buttons" example
.example-button .heading-small {
margin-top: 0;
}
// Make swatch wrapper full width for "Creating buttons" example
.example-button .swatch-wrapper {
width: 100%;
}
// 9. Alpha beta banners
// ==========================================================================
// Alpha
.phase-banner-alpha {
@include phase-banner($state: alpha);
}
// Beta
.phase-banner-beta {
@include phase-banner($state: beta);
}