Projet

Général

Profil

0001-scss-use-mixin-to-style-notification-messages-25297.patch

Frédéric Péters, 01 mars 2020 10:04

Télécharger (4,17 ko)

Voir les différences:

Subject: [PATCH 1/7] scss: use mixin to style notification messages (#25297)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This also allows replacing compound selector by a simple %extend, as
required for sassc ≥ 3.6.1.
 static/hautes-alpes-2018/_custom.scss |  2 +-
 static/includes/_misc.scss            | 61 ++++++++-------------------
 static/strasbourg-2018/_custom.scss   |  2 +-
 3 files changed, 19 insertions(+), 46 deletions(-)
static/hautes-alpes-2018/_custom.scss
17 17

  
18 18
	// override .errornotice (includes/misc)
19 19
	%custom-error-notice {
20
		@extend div.errornotice;
20
		@extend .errornotice;
21 21
		&::before {
22 22
			font-size: 30px;
23 23
		}
static/includes/_misc.scss
260 260
	}
261 261
}
262 262

  
263
#messages li,
264
div.infonotice,
265
div.successnotice,
266
div.warningnotice,
267
div.errornotice {
268
	background: $notification_error_color;
269
	color: text-color($notification_error_color);
263
@mixin notification-message($color, $symbol) {
264
	background: $color;
265
	color: text-color($color);
270 266
	margin: 1rem 0;
271 267
	padding: 0.5rem;
272 268
	padding-left: 4rem;
273 269
	position: relative;
274 270
	@if $notification-style == border-icon {
275
		border-left: 4px solid darken($notification_error_color, 40%);
271
		border-left: 4px solid darken($color, 40%);
276 272
		padding-left: 2rem;
277 273
	}
278 274

  
279 275
	min-height: 2rem;
280 276
	&::before {
281
		content: "\f06a";
277
		content: $symbol;
282 278
		font-family: FontAwesome;
283 279
		font-size: 2rem;
284 280
		position: absolute;
285 281
		left: 1rem;
286 282
		top: 0.5rem;
287 283
		@if $notification-style == border-icon {
288
			color: darken($notification_error_color, 40%);
284
			color: darken($color, 40%);
289 285
			left: calc(-0.5rem - 2px);
290 286
			width: 1rem;
291 287
			display: block;
......
307 303
	}
308 304
}
309 305

  
310
#messages li.warning,
311
div.warningnotice {
312
	background: $notification_warning_color;
313
	color: text-color($notification_warning_color);
314
	border-color: darken($notification_warning_color, 40%);
315
	&::before {
316
		content: "\f071";
317
		@if $notification-style == border-icon {
318
			color: darken($notification_warning_color, 40%);
319
		}
320
	}
306
#messages li.error, .errornotice {
307
	@include notification-message($notification_error_color, "\f06a");
321 308
}
322 309

  
323
#messages li.success,
324
div.successnotice {
325
	background: $notification_success_color;
326
	color: text-color($notification_success_color);
327
	border-color: darken($notification_success_color, 40%);
328
	&::before {
329
		content: "\f058";  // check-circle
330
		@if $notification-style == border-icon {
331
			color: darken($notification_success_color, 40%);
332
		}
333
	}
310
#messages li.warning, .warningnotice {
311
	@include notification-message($notification_warning_color, "\f071");
334 312
}
335 313

  
336
#messages li.info,
337
div.infonotice {
338
	background: $notification_info_color;
339
	color: text-color($notification_info_color);
340
	border-color: darken($notification_info_color, 40%);
341
	&::before {
342
		content: "\f05a";
343
		@if $notification-style == border-icon {
344
			color: darken($notification_info_color, 40%);
345
		}
346
	}
314
#messages li.success, .successnotice {
315
	@include notification-message($notification_success_color, "\f058"); // check-circle
316
}
317

  
318
#messages li.info, .infonotice {
319
	@include notification-message($notification_info_color, "\f05a");
347 320
}
348 321

  
349 322
form ul.errorlist.nonfield {
350 323
	margin-top: 0;
351 324
	li {
352
		@extend div.errornotice;
325
		@extend .errornotice;
353 326
		margin-top: 0;
354 327
	}
355 328
}
static/strasbourg-2018/_custom.scss
398 398
}
399 399

  
400 400
div.widget div.content div.error {
401
	@extend div.errornotice;
401
	@extend .errornotice;
402 402
	margin-top: 0;
403 403
}
404 404

  
405
-