Projet

Général

Profil

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

Anonyme, 23 juillet 2018 17:28

Télécharger (9,36 ko)

Voir les différences:

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

 help/fr/misc-scss.page           |  30 ++++
 static/includes/_form-steps.scss | 232 +++++++++++++++++++++++++++++++
 static/includes/_wcs.scss        |  69 ++++-----
 3 files changed, 292 insertions(+), 39 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
		padding: 0 1em;
19

  
20
		ol {
21
			// reduce empty space on the left (user agent stylesheet)
22
			padding-left: 0;
23
			margin-left: -1em;
24
		}
25

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

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

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

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

  
84
			&.current {
85
				font-weight: bold;
86

  
87
				span.label {
88
					color: $title-color;
89
				}
90

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

  
98
			@if $circle-steps-with-lines {
99

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

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

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

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

  
143
				li {
144
					padding: 0 1em;
145
					height: auto;
146

  
147
					&.first {
148
						padding-left: 0;
149
					}
150

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

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

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

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

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

  
38
@if $circle-steps {
39
	// in order to let more space to the labels
40
	div#gauche {
41
		min-width: 18.5%;
42
		max-width: 25%;
43
		width: auto;
44
	}
45

  
46
	div#gauche + div#rub_service {
47
		min-width: 73%;
48
		float: left;
49
		width: auto;
50
	}
36 51

  
52
	@media screen and (max-width: $mobile-limit) {
53
		div#gauche {
54
			min-width: inherit;
55
			max-width: inherit;
56
			float: none;
57
			width: 100%;
58
		}
59

  
60
		div#gauche + div#rub_service {
61
			min-width: inherit;
62
			float: none;
63
			width: 100%;
64
		}
65
	}
66
}
37 67
/* style homepage blocks */
38 68
div#services > ul {
39 69
	@include vendor-prefix('column-count', '2');
......
106 136
	margin: 1em;
107 137
}
108 138

  
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 139
@if ($responsive-steps == horizontal) {
141 140
@media screen and (max-width: $mobile-limit) {
142 141
	div#gauche {
......
157 156
	div#steps {
158 157
		position: static;
159 158
		margin: 0;
160
		color: #aaa;
161 159
		white-space: nowrap;
162 160
		overflow: hidden;
163 161
		width: 100%;
......
180 178
					position: static;
181 179
					padding: 2px 9px;
182 180
					font-weight: bold;
183
					color: white;
184 181
					text-align: center;
185
					background: #ddd;
186 182
					border-radius: $border-radius;
187
					border: 1px solid #ddd;
188 183
				}
189 184
			}
190 185
			& li.current {
191
				background: inherit;
192
				color: inherit;
193 186
				& span.label {
194 187
					font-weight: normal;
195 188
				}
196 189
				& span.marker {
197
					background: $title-background;
198
					color: $title-color;
199 190
					border-radius: $border-radius;
200 191
				}
201 192
			}
202
-