]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/sass/include/_mixins.scss
Fix checkbox outline
[github/Chocobozzz/PeerTube.git] / client / src / sass / include / _mixins.scss
1 @import '_variables';
2
3 @mixin disable-default-a-behaviour {
4 &:hover, &:focus, &:active {
5 text-decoration: none !important;
6 outline: none !important;
7 }
8 }
9
10 @mixin disable-outline {
11 &:focus:not(.focus-visible) {
12 outline: none;
13 }
14
15 &::-moz-focus-inner {
16 border: 0;
17 padding: 0
18 }
19 }
20
21
22 @mixin ellipsis {
23 white-space: nowrap;
24 overflow: hidden;
25 text-overflow: ellipsis;
26 }
27
28 @mixin ellipsis-multiline($font-size: 16px, $number-of-lines: 2) {
29 display: block;
30 /* Fallback for non-webkit */
31 display: -webkit-box;
32 max-height: $font-size * $number-of-lines;
33 /* Fallback for non-webkit */
34 font-size: $font-size;
35 line-height: $font-size;
36 overflow: hidden;
37 text-overflow: ellipsis;
38 }
39
40 @mixin prefix($property, $parameters...) {
41 @each $prefix in -webkit-, -moz-, -ms-, -o-, "" {
42 #{$prefix}#{$property}: $parameters;
43 }
44 }
45
46 @mixin peertube-word-wrap {
47 word-break: normal;
48 word-wrap: break-word;
49 overflow-wrap: break-word;
50 -webkit-hyphens: auto;
51 -ms-hyphens: auto;
52 -moz-hyphens: auto;
53 hyphens: auto;
54 }
55
56 @mixin apply-svg-color ($color) {
57 /deep/ svg {
58 path[fill="#000000"],
59 g[fill="#000000"],
60 rect[fill="#000000"],
61 circle[fill="#000000"],
62 polygon[fill="#000000"] {
63 fill: $color;
64 }
65
66 path[stroke="#000000"],
67 g[stroke="#000000"],
68 rect[stroke="#000000"],
69 circle[stroke="#000000"],
70 polygon[stroke="#000000"] {
71 stroke: $color;
72 }
73
74 stop[stop-color="#000000"] {
75 stop-color: $color;
76 }
77 }
78 }
79
80 @mixin peertube-input-text($width) {
81 display: inline-block;
82 height: $button-height;
83 width: $width;
84 background: var(--inputColor);
85 border: 1px solid #C6C6C6;
86 border-radius: 3px;
87 padding-left: 15px;
88 padding-right: 15px;
89 font-size: 15px;
90
91 &::placeholder {
92 color: var(--inputPlaceholderColor);
93 }
94
95 @media screen and (max-width: $width) {
96 width: 100%;
97 }
98 }
99
100 @mixin peertube-input-group($width) {
101 width: $width;
102 height: $button-height;
103 padding-top: 0;
104 padding-bottom: 0;
105
106 .input-group-text{
107 font-size: 14px;
108 color: gray;
109 }
110 }
111
112 @mixin peertube-textarea ($width, $height) {
113 @include peertube-input-text($width);
114
115 height: $height;
116 padding: 5px 15px;
117 font-size: 15px;
118 }
119
120 @mixin orange-button {
121 &, &:active, &:focus {
122 color: #fff;
123 background-color: var(--mainColor);
124 }
125
126 &:hover {
127 color: #fff;
128 background-color: var(--mainHoverColor);
129 }
130
131 &[disabled], &.disabled {
132 cursor: default;
133 color: #fff;
134 background-color: #C6C6C6;
135 }
136
137 my-global-icon {
138 @include apply-svg-color(#fff)
139 }
140 }
141
142 @mixin grey-button {
143 &, &:active, &:focus {
144 background-color: $grey-background-color;
145 color: $grey-foreground-color;
146 }
147
148 &:hover, &:active, &:focus, &[disabled], &.disabled {
149 color: $grey-foreground-color;
150 background-color: $grey-background-hover-color;
151 }
152
153 &[disabled], &.disabled {
154 cursor: default;
155 }
156
157 my-global-icon {
158 @include apply-svg-color($grey-foreground-color)
159 }
160 }
161
162 @mixin peertube-button {
163 border: none;
164 font-weight: $font-semibold;
165 font-size: 15px;
166 height: $button-height;
167 line-height: $button-height;
168 border-radius: 3px;
169 text-align: center;
170 padding: 0 17px 0 13px;
171 cursor: pointer;
172 outline: 0;
173 }
174
175 @mixin peertube-button-link {
176 display: inline-block;
177
178 @include disable-default-a-behaviour;
179 @include peertube-button;
180 }
181
182 @mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) {
183 my-global-icon {
184 position: relative;
185 width: $width;
186 margin-right: $margin-right;
187 top: $top;
188 }
189 }
190
191 @mixin peertube-button-file ($width) {
192 position: relative;
193 overflow: hidden;
194 display: inline-block;
195 width: $width;
196
197 @include peertube-button;
198 @include orange-button;
199
200 input[type=file] {
201 position: absolute;
202 top: 0;
203 right: 0;
204 min-width: 100%;
205 min-height: 100%;
206 font-size: 100px;
207 text-align: right;
208 filter: alpha(opacity=0);
209 opacity: 0;
210 outline: none;
211 background: white;
212 cursor: inherit;
213 display: block;
214 }
215 }
216
217 @mixin icon ($size) {
218 display: inline-block;
219 background-repeat: no-repeat;
220 background-size: contain;
221 width: $size;
222 height: $size;
223 vertical-align: middle;
224 cursor: pointer;
225 }
226
227 @mixin peertube-select-container ($width) {
228 padding: 0;
229 margin: 0;
230 border: 1px solid #C6C6C6;
231 width: $width;
232 border-radius: 3px;
233 overflow: hidden;
234 background: var(--inputColor);
235 position: relative;
236 font-size: 15px;
237
238 @media screen and (max-width: $width) {
239 width: 100%;
240 }
241
242 &:after {
243 top: 50%;
244 right: calc(0% + 15px);
245 content: " ";
246 height: 0;
247 width: 0;
248 position: absolute;
249 pointer-events: none;
250 border: 5px solid rgba(0, 0, 0, 0);
251 border-top-color: #000;
252 margin-top: -2px;
253 z-index: 100;
254 }
255
256 select {
257 padding: 0 35px 0 12px;
258 width: calc(100% + 2px);
259 position: relative;
260 left: 1px;
261 border: none;
262 box-shadow: none;
263 background: transparent none;
264 appearance: none;
265 cursor: pointer;
266 height: $button-height;
267 text-overflow: ellipsis;
268 color: var(--mainForegroundColor);
269
270 &:focus {
271 outline: none;
272 }
273
274 &:-moz-focusring {
275 color: transparent;
276 text-shadow: 0 0 0 #000;
277 }
278
279 option {
280 color: #000;
281 }
282 }
283 }
284
285 @mixin peertube-select-disabled-container ($width) {
286 @include peertube-select-container($width);
287
288 background-color: #E5E5E5;
289
290 select {
291 cursor: default;
292 }
293 }
294
295 // Thanks: https://codepen.io/triss90/pen/XNEdRe/
296 @mixin peertube-radio-container {
297 input[type="radio"] {
298 display: none;
299
300 & + label {
301 font-weight: $font-regular;
302 cursor: pointer;
303
304 &:before {
305 position: relative;
306 top: -2px;
307 content: '';
308 background: #fff;
309 border-radius: 100%;
310 border: 1px solid #000;
311 display: inline-block;
312 width: 15px;
313 height: 15px;
314 vertical-align: middle;
315 cursor: pointer;
316 text-align: center;
317 margin-right: 10px;
318 }
319 }
320
321 &:checked + label:before {
322 background-color: #000;
323 box-shadow: inset 0 0 0 4px #fff;
324 }
325
326 &:focus + label:before {
327 outline: none;
328 border-color: #000;
329 }
330 }
331 }
332
333 @mixin peertube-checkbox ($border-width) {
334 opacity: 0;
335 position: absolute;
336
337 &:focus + span {
338 outline: 1px solid #1e5180;
339 }
340
341 & + span {
342 position: relative;
343 width: 18px;
344 height: 18px;
345 border: $border-width solid var(--mainForegroundColor);
346 border-radius: 3px;
347 vertical-align: middle;
348 cursor: pointer;
349
350 &:after {
351 content: '';
352 position: absolute;
353 top: calc(2px - #{$border-width});
354 left: 5px;
355 width: 5px;
356 height: 12px;
357 opacity: 0;
358 transform: rotate(45deg) scale(0);
359 border-right: 2px solid var(--mainBackgroundColor);
360 border-bottom: 2px solid var(--mainBackgroundColor);
361 }
362 }
363
364 &:checked + span {
365 border-color: transparent;
366 background: var(--mainColor);
367 animation: jelly 0.6s ease;
368
369 &:after {
370 opacity: 1;
371 transform: rotate(45deg) scale(1);
372 }
373 }
374
375 & + span + span {
376 font-size: 15px;
377 font-weight: $font-regular;
378 margin-left: 5px;
379 cursor: pointer;
380 display: inline;
381 }
382
383 &[disabled] + span,
384 &[disabled] + span + span{
385 opacity: 0.5;
386 cursor: default;
387 }
388 }
389
390
391 @mixin avatar ($size) {
392 object-fit: cover;
393 border-radius: 50%;
394 width: $size;
395 height: $size;
396 }
397
398 @mixin chevron ($size, $border-width) {
399 border-style: solid;
400 border-width: $border-width $border-width 0 0;
401 content: '';
402 display: inline-block;
403 transform: rotate(-45deg);
404 height: $size;
405 width: $size;
406 }
407
408 @mixin chevron-right ($size, $border-width) {
409 @include chevron($size, $border-width);
410
411 left: 0;
412 transform: rotate(45deg);
413 }
414
415 @mixin chevron-left ($size, $border-width) {
416 @include chevron($size, $border-width);
417
418 left: 0.25em;
419 transform: rotate(-135deg);
420 }
421
422 @mixin in-content-small-title {
423 text-transform: uppercase;
424 color: var(--mainColor);
425 font-weight: $font-bold;
426 font-size: 13px;
427 }
428
429 @mixin actor-owner {
430 @include disable-default-a-behaviour;
431
432 display: inline-table;
433 font-size: 13px;
434 margin-top: 4px;
435 color: var(--mainForegroundColor);
436
437 span:hover {
438 opacity: 0.8;
439 }
440
441 img {
442 @include avatar(18px);
443
444 margin-left: 7px;
445 position: relative;
446 top: -2px;
447 }
448 }
449
450 @mixin sub-menu-with-actor {
451 height: 160px;
452 display: flex;
453 flex-direction: column;
454 align-items: flex-start;
455
456 .actor {
457 display: flex;
458 margin-top: 20px;
459 margin-bottom: 20px;
460
461 img {
462 @include avatar(80px);
463
464 margin-right: 20px;
465 }
466
467 .actor-info {
468 display: flex;
469 flex-direction: column;
470 justify-content: center;
471
472 .actor-names {
473 display: flex;
474 align-items: center;
475
476 .actor-display-name {
477 font-size: 23px;
478 font-weight: $font-bold;
479 }
480
481 .actor-name {
482 margin-left: 7px;
483 position: relative;
484 top: 3px;
485 font-size: 14px;
486 color: $grey-actor-name;
487 }
488 }
489
490 .actor-followers {
491 font-size: 15px;
492 }
493
494 .actor-owner {
495 @include actor-owner;
496 }
497 }
498 }
499
500 .links {
501 margin-top: 0;
502 margin-bottom: 10px;
503
504 a {
505 margin-top: 0;
506 margin-bottom: 0;
507 }
508 }
509 }
510
511 @mixin create-button {
512 @include peertube-button-link;
513 @include orange-button;
514 @include button-with-icon(20px, 5px, -1px);
515 }
516
517 @mixin row-blocks {
518 display: flex;
519 min-height: 130px;
520 padding-bottom: 20px;
521 margin-bottom: 20px;
522 border-bottom: 1px solid #C6C6C6;
523
524 @media screen and (max-width: 800px) {
525 flex-direction: column;
526 height: auto;
527 align-items: center;
528 }
529 }
530
531 @mixin dropdown-with-icon-item {
532 padding: 6px 24px;
533
534 my-global-icon {
535 width: 24px;
536
537 margin-right: 10px;
538 position: relative;
539 top: -2px;
540 }
541 }