Projet

Général

Profil

0001-add-option-to-display-circle-steps-23533.patch

Anonyme, 26 juillet 2018 15:18

Télécharger (8,87 ko)

Voir les différences:

Subject: [PATCH 1/2] add option to display circle steps (#23533)

 help/fr/misc-scss.page           |  30 ++++
 static/includes/_form-steps.scss | 230 +++++++++++++++++++++++++++++++
 static/includes/_wcs.scss        |  43 +-----
 3 files changed, 263 insertions(+), 40 deletions(-)
 create mode 100644 static/includes/_form-steps.scss
help/fr/misc-scss.page
358 358
  <td><p>Taille de l'arrondi à appliquer aux champs de formulaire (texte, liste…)</p></td>
359 359
  <td><p><var>0</var></p></td>
360 360
 </tr>
361
 <tr>
362
  <td><p><code>$circle-steps</code></p></td>
363
  <td><p>Active la présentation en cercles des étapes</p></td>
364
  <td><p><var>false</var></p></td>
365
 </tr>
366
 <tr>
367
  <td><p><code>$circle-steps-with-lines</code></p></td>
368
  <td><p>Active les lignes entre les cercles</p></td>
369
  <td><p><var>true</var></p></td>
370
 </tr>
371
 <tr>
372
  <td><p><code>$circle-steps-diameter</code></p></td>
373
  <td><p>Diamètre des cercles</p></td>
374
  <td><p><var>56px</var></p></td>
375
 </tr>
376
 <tr>
377
  <td><p><code>$circle-steps-number-color</code></p></td>
378
  <td><p>Couleur des nombres à l'intérieur des cercles</p></td>
379
  <td><p><var>#868686</var></p></td>
380
 </tr>
381
 <tr>
382
  <td><p><code>$circle-steps-current-number-color</code></p></td>
383
  <td><p>Couleur des nombres de l'étape courante</p></td>
384
  <td><p><var>white</var></p></td>
385
 </tr>
386
 <tr>
387
  <td><p><code>$circle-steps-current-marker-background</code></p></td>
388
  <td><p>Couleur de fond du cercle de l'étape courante</p></td>
389
  <td><p><var>$primary-color</var></p></td>
390
 </tr>
361 391
</table>
362 392
</section>
363 393

  
static/includes/_form-steps.scss
1
$circle-steps: false !default;
2
$circle-steps-with-lines: true !default;
3
$circle-steps-diameter: 56px !default;
4
$circle-steps-number-color: #868686 !default;
5
$circle-steps-current-number-color: white !default;
6
$circle-steps-current-marker-background: $primary-color !default;
7

  
8
// private variables
9
$_circle-lines-thickness: 1px !default;
10
$_steps-height: $circle-steps-diameter;
11
$_steps-border: 1px;
12

  
13
/* circle steps or squared steps */
14

  
15
@if $circle-steps {
16

  
17
	div#steps {
18
		ol {
19
			// reduce empty space on the left (user agent stylesheet)
20
			padding-left: 0;
21
			margin-left: 0;
22
		}
23

  
24
		li {
25
			display: -ms-flexbox;
26
			display: flex;
27
			padding: 0;
28
			margin: $_steps-height 0;
29
			width: auto;
30
			position: relative;
31
			border: 0;
32
			background: transparent;
33
			justify-content: space-between;
34
			-ms-justify-content: space-between;
35
			align-items: center;
36
			-ms-align-items: center;
37
			flex-direction: row;
38
			-ms-flex-direction: row;
39

  
40
			> span {
41
				flex-shrink: 0;
42
				flex-basis: $circle-steps-diameter;
43
			}
44

  
45
			span.marker {
46
				display: inline-flex;
47
				flex-grow: 0;
48
				align-items: center;
49
				-ms-align-items: center;
50
				justify-content: center;
51
				-ms-justify-content: center;
52
				margin: 0 1em 0 0;
53
				position: relative;
54
				color: $circle-steps-number-color;
55
				background: white;
56
				border: $_steps-border solid  $circle-steps-number-color;
57
				border-radius: 50%;
58
				font-size: 100%;
59
				font-weight: bold;
60
				text-align: center;
61
				vertical-align: middle;
62
				width: $circle-steps-diameter;
63
				height: $circle-steps-diameter;
64
				// bug on IE11 (https://github.com/philipwalton/flexbugs#flexbug-2)
65
				max-width: 100%;
66
				max-height: 100%;
67
				box-sizing: border-box;
68
				// hide the circle inside the marker
69
				&::before {
70
					display: none;
71
				}
72
			}
73

  
74
			span.label {
75
				margin: 0;
76
				flex-grow: 1;
77
				color: #868686;
78
				text-align: left;
79
				vertical-align: middle;
80
			}
81

  
82
			&.current {
83
				font-weight: bold;
84

  
85
				span.label {
86
					color: $title-color;
87
				}
88

  
89
				span.marker {
90
					color: $circle-steps-current-number-color;
91
					border-color: $circle-steps-current-marker-background;
92
					background: $circle-steps-current-marker-background;
93
				}
94
			}
95

  
96
			@if $circle-steps-with-lines {
97

  
98
				&.first {
99
					span.marker::after {
100
						display: none;
101
					}
102
				}
103

  
104
				span.marker::after {
105
					content: ' ';
106
					z-index: -1; // line below the rest
107
					position: absolute;
108
					height: $_steps-height + $circle-steps-diameter / 2 + $_steps-border;
109
					width: $_circle-lines-thickness;
110
					bottom: $circle-steps-diameter - $_steps-border;
111
					right: 50%;
112
					background-color: $circle-steps-number-color;
113
					padding: 0;
114
				}
115
			}
116
		}
117
	}
118

  
119
	@media screen and (max-width: $mobile-limit) {
120
		div#gauche div#steps {
121
			order: 1;
122
			-ms-order: 1;
123
			padding: 1em 0;
124

  
125
			ol {
126
				display: flex;
127
				display: -ms-flexbox;
128
				flex-direction: row;
129
				-ms-flex-direction: row;
130
				justify-content: center;
131
				-ms-justify-content: center;
132
				flex-flow: nowrap;
133
				-ms-flex-flow: nowrap;
134
				align-items: center;
135
				-ms-align-items: center;
136
				// bug on IE11 (https://github.com/philipwalton/flexbugs#flexbug-2)
137
				max-width: 100%;
138
				max-height: 100%;
139
				box-sizing: border-box;
140

  
141
				li {
142
					padding: 0 1em;
143
					height: auto;
144

  
145
					&.first {
146
						padding-left: 0;
147
					}
148

  
149
					span.marker {
150
						margin: 0;
151
						padding: 0 9px;
152
						border-radius: 50%;
153
						width: $circle-steps-diameter;
154
						height: $circle-steps-diameter;
155

  
156
						@if $circle-steps-with-lines {
157
							&::after {
158
								content: ' ';
159
								position: absolute;
160
								padding: 0;
161
								height: $_circle-lines-thickness;
162
								width: $circle-steps-diameter + $_steps-border * 2;
163
								left: -$circle-steps-diameter / 2 - $_steps-border;
164
								bottom: 50%;
165
							}
166
						}
167
					}
168
					// hide labels on little screens
169
					span.label {
170
						display: none;
171
					}
172
				}
173
			}
174
		}
175
	}
176
} @else {
177
	// squared steps
178
	div#steps ol {
179
		margin: 0;
180
		padding: 0;
181
		text-align: left;
182
		list-style: none;
183
		color: #868686;
184

  
185
		& li {
186
			border: 0;
187
			border-bottom: 1px solid #CCC;
188
			margin-bottom: 2ex;
189
			border-radius: $border-radius;
190
			padding: 1ex;
191
			letter-spacing: 1px;
192
		}
193
		& li.current {
194
			border: 0;
195
			background: $title-background;
196
			color: $title-color;
197
			& span.label {
198
				font-weight: bold;
199
			}
200
		}
201
		& li span.marker {
202
			display: block;
203
			font-size: 250%;
204
		}
205
	}
206
	@if ($responsive-steps == horizontal) {
207
		@media screen and (max-width: $mobile-limit) {
208
			div#steps {
209
				color: #AAA;
210
				& ol {
211
					& li {
212
						& span.marker {
213
							color: white;
214
							background: #DDD;
215
							border: 1px solid #DDD;
216
						}
217
					}
218
					& li.current {
219
						background: inherit;
220
						color: inherit;
221
						& span.marker {
222
							background: $title-background;
223
							color: $title-color;
224
						}
225
					}
226
				}
227
			}
228
		}
229
	}
230
}
static/includes/_wcs.scss
1 1
@import 'grid';
2 2

  
3 3
$responsive-steps: horizontal !default;
4
$circle-steps: false !default;
5

  
6
@import 'form-steps';
4 7

  
5 8
/* hide a bunch of elements */
6 9
div#droite,
......
33 36
	clear: none;
34 37
}
35 38

  
36

  
37 39
/* style homepage blocks */
38 40
div#services > ul {
39 41
	@include vendor-prefix('column-count', '2');
......
106 108
	margin: 1em;
107 109
}
108 110

  
109
/* steps */
110

  
111
div#steps ol {
112
	text-align: left;
113
	margin: 0;
114
	padding: 0;
115
	list-style: none;
116
	color: #868686;
117

  
118
	& li {
119
		border: 0;
120
		border-bottom: 1px solid #ccc;
121
		margin-bottom: 2ex;
122
		border-radius: $border-radius;
123
		padding: 1ex;
124
		letter-spacing: 1px;
125
	}
126
	& li.current {
127
		border: 0;
128
		background: $title-background;
129
		color: $title-color;
130
		& span.label {
131
			font-weight: bold;
132
		}
133
	}
134
	& li span.marker {
135
		font-size: 250%;
136
		display: block;
137
	}
138
}
139

  
140 111
@if ($responsive-steps == horizontal) {
141 112
@media screen and (max-width: $mobile-limit) {
142 113
	div#gauche {
......
157 128
	div#steps {
158 129
		position: static;
159 130
		margin: 0;
160
		color: #aaa;
161 131
		white-space: nowrap;
162 132
		overflow: hidden;
163 133
		width: 100%;
......
180 150
					position: static;
181 151
					padding: 2px 9px;
182 152
					font-weight: bold;
183
					color: white;
184 153
					text-align: center;
185
					background: #ddd;
186 154
					border-radius: $border-radius;
187
					border: 1px solid #ddd;
188 155
				}
189 156
			}
190 157
			& li.current {
191
				background: inherit;
192
				color: inherit;
193 158
				& span.label {
194 159
					font-weight: normal;
195 160
				}
196 161
				& span.marker {
197
					background: $title-background;
198
					color: $title-color;
199 162
					border-radius: $border-radius;
200 163
				}
201 164
			}
202
-