Projet

Général

Profil

0001-scss-introduce-pk-information-attention-error-classe.patch

Frédéric Péters, 10 août 2020 12:00

Télécharger (5,82 ko)

Voir les différences:

Subject: [PATCH] scss: introduce pk-information/attention/error classes
 (#33135)

 help/fr/misc-css-classes.page | 24 +++++++++++++++
 static/includes/_cells.scss   |  2 +-
 static/includes/_library.scss | 12 ++++++++
 static/includes/_misc.scss    | 56 ++++++++++++++++++++++++++---------
 4 files changed, 79 insertions(+), 15 deletions(-)
help/fr/misc-css-classes.page
61 61
   « titre et liens », pour cela le texte doit contenir un titre
62 62
   (&lt;h2&gt;) suivi d'une liste de liens (&lt;ul&gt;).</p></td>
63 63
 </tr>
64
 <tr>
65
  <td><p><code>pk-information</code></p></td>
66
  <td><p>Donne à la cellule le style de bloc d’information.</p></td>
67
 </tr>
68
 <tr>
69
  <td><p><code>pk-attention</code></p></td>
70
  <td><p>Donne à la cellule le style de bloc d’attention.</p></td>
71
 </tr>
72
 <tr>
73
  <td><p><code>pk-error</code></p></td>
74
  <td><p>Donne à la cellule le style de bloc d’erreur.</p></td>
75
 </tr>
64 76
</table>
65 77

  
66 78
</section>
......
83 95
  <td><p>Marque le champ comme étant particulièrement important, le rendu sera
84 96
  généralement un libellé mis en gras.</p></td>
85 97
 </tr>
98
 <tr>
99
  <td><p><code>pk-information</code></p></td>
100
  <td><p>Marque le champ commentaire avec le style de bloc d’information.</p></td>
101
 </tr>
102
 <tr>
103
  <td><p><code>pk-attention</code></p></td>
104
  <td><p>Marque le champ commentaire avec le style de bloc d’attention.</p></td>
105
 </tr>
106
 <tr>
107
  <td><p><code>pk-error</code></p></td>
108
  <td><p>Marque le champ commentaire avec le style de bloc d’erreur.</p></td>
109
 </tr>
86 110
</table>
87 111
</section>
88 112

  
static/includes/_cells.scss
84 84
div.a2-continue,
85 85
div#services > ul > li,
86 86
div.a2-block,
87
.gru-content div.cell,
87
.gru-content .cell,
88 88
.block {
89 89
	text-align: left;
90 90
	background: $cell-background;
static/includes/_library.scss
115 115
		width: 30%;
116 116
	}
117 117
}
118

  
119
.pk-information {
120
	@include notification-message($notification_info_color, "\f05a");
121
}
122

  
123
.pk-attention {
124
	@include notification-message($notification_warning_color, "\f071");
125
}
126

  
127
.pk-error {
128
	@include notification-message($notification_error_color, "\f06a");
129
}
static/includes/_misc.scss
10 10
//  border-icon: colored icon on left boder
11 11
$notification-style: classic !default;
12 12

  
13
$notification-left-padding: 4rem;
14
@if $notification-style == border-icon {
15
	$notification-left-padding: 2rem;
16
}
17

  
13 18
div.textcell {
14 19
	h3, h4, h5, p, table {
15 20
		margin: 0.7em 0.5rem;
......
295 300
	}
296 301
}
297 302

  
298
@mixin notification-message($color, $symbol) {
303
@mixin notification-message-base($color, $symbol) {
299 304
	box-sizing: content-box;
300 305
	background: $color;
301 306
	color: text-color($color);
302 307
	margin: 1rem 0;
303 308
	padding: 0.5rem;
304
	padding-left: 4rem;
309
	padding-left: $notification-left-padding;
305 310
	position: relative;
306 311
	@if $notification-style == border-icon {
307 312
		border-left: 4px solid darken($color, 40%);
308
		padding-left: 2rem;
309 313
	}
310 314

  
311 315
	min-height: 2rem;
......
339 343
	}
340 344
}
341 345

  
342
#messages li.error, .errornotice {
343
	@include notification-message($notification_error_color, "\f06a");
344
}
346
@mixin notification-message($color, $symbol) {
347
	@include notification-message-base($color, $symbol);
348
	&[class*=grid-].comment-field {
349
		// adapt when used as comment field in grid system.
350
		@if $grid-gutter != 0px {
351
			box-sizing: border-box;
352
		}
353
		margin-right: 1rem;
354
	}
355
	&:not([class*=grid-]).comment-field {
356
		// clear everything if not in a grid.
357
		clear: both;
358
	}
345 359

  
346
#messages li.warning, .warningnotice {
347
	@include notification-message($notification_warning_color, "\f071");
360
	&.cell {
361
		// increased selector weight is required for cells.
362
		background: $color !important;
363
		padding-bottom: 0.5em !important;
364
		h2:first-child {
365
			color: darken($color, 40%) !important;
366
			border-color: darken($color, 40%) !important;
367
		}
368
		& > div {
369
			padding-left: $notification-left-padding;
370
		}
371
	}
348 372
}
349 373

  
350
#messages li.success, .successnotice {
351
	@include notification-message($notification_success_color, "\f058"); // check-circle
352
}
374
#messages li.error { @include notification-message-base($notification_error_color, "\f06a") }
375
.errornotice { @include notification-message($notification_error_color, "\f06a"); }
353 376

  
354
#messages li.info, .infonotice {
355
	@include notification-message($notification_info_color, "\f05a");
356
}
377
#messages li.warning { @include notification-message-base($notification_warning_color, "\f071"); }
378
.warningnotice { @include notification-message($notification_warning_color, "\f071"); }
379

  
380
#messages li.success { @include notification-message-base($notification_success_color, "\f058"); } // check-circle
381
.successnotice { @include notification-message($notification_success_color, "\f058"); }
382

  
383
#messages li.info { @include notification-message-base($notification_info_color, "\f05a"); }
384
.infonotice { @include notification-message($notification_info_color, "\f05a"); }
357 385

  
358 386
#messages li {
359 387
	&.error, &.warning, &.success, &.info {
360
-