]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
Fix form control focus colors
[github/Chocobozzz/PeerTube.git] / client / src / sass / include / _mixins.scss
CommitLineData
8cbc40b2
C
1@use 'sass:math';
2@use '_variables' as *;
63c4db6d 3
27f84cc3
W
4@import '_bootstrap-mixins';
5
26c6ee80 6@mixin disable-default-a-behaviour {
931d3430
C
7 &:hover,
8 &:focus,
9 &:active {
26c6ee80
C
10 text-decoration: none !important;
11 outline: none !important;
12 }
13}
c30745f3 14
3ec8dc09 15@mixin disable-outline {
e78980eb
RK
16 &:focus:not(.focus-visible) {
17 outline: none;
18 }
3ec8dc09
C
19}
20
ef80c66c
C
21@mixin ellipsis {
22 white-space: nowrap;
23 overflow: hidden;
24 text-overflow: ellipsis;
25}
0c9945d9 26
2987c34e 27@mixin ellipsis-multiline($font-size: 16px, $number-of-lines: 2, $line-height: $font-size) {
769ac6c1
RK
28 display: block;
29 /* Fallback for non-webkit */
931d3430 30 display: -webkit-box; /* stylelint-disable-line value-no-vendor-prefix */
33253c1a 31 -webkit-line-clamp: $number-of-lines;
9fb75b16 32 -webkit-box-orient: vertical;
769ac6c1
RK
33 /* Fallback for non-webkit */
34 font-size: $font-size;
2987c34e 35 line-height: $line-height;
769ac6c1
RK
36 overflow: hidden;
37 text-overflow: ellipsis;
33253c1a 38 max-height: $font-size * $number-of-lines;
769ac6c1
RK
39}
40
9589907c
C
41@mixin muted {
42 color: pvar(--greyForegroundColor) !important;
43}
44
60c35932
C
45@mixin fade-text ($fade-after, $background-color) {
46 position: relative;
47 overflow: hidden;
48
931d3430 49 &::after {
60c35932
C
50 content: '';
51 pointer-events: none;
52 width: 100%;
53 height: 100%;
54 position: absolute;
55 left: 0;
56 top: 0;
57 background: linear-gradient(transparent $fade-after, $background-color);
769ac6c1
RK
58 }
59}
60
06ec4bdd 61@mixin peertube-word-wrap ($with-hyphen: true) {
fc641ded 62 word-break: break-word;
7a14004b
C
63 word-wrap: break-word;
64 overflow-wrap: break-word;
06ec4bdd
C
65
66 @if $with-hyphen {
67 hyphens: auto;
68 }
7a14004b
C
69}
70
457bb213 71@mixin apply-svg-color ($color) {
c41c0e28 72 ::ng-deep .feather,
5351a058
C
73 ::ng-deep .material,
74 ::ng-deep .misc {
c41c0e28
RK
75 color: $color;
76 }
457bb213
C
77}
78
d3217560
RK
79@mixin fill-svg-color ($color) {
80 ::ng-deep svg {
81 path {
82 fill: $color;
83 }
84 }
85}
86
a6d5ff76
RK
87@mixin button-focus($color) {
88 &:focus,
e40afb5b 89 &.focus-visible {
6a4c30de 90 box-shadow: #{$focus-box-shadow-form} $color;
e40afb5b
RK
91 }
92}
93
c30745f3 94@mixin peertube-input-text($width) {
d9a37011 95 padding: 4px 15px;
c30745f3 96 display: inline-block;
c30745f3 97 width: $width;
4c8749cb 98 max-width: $width;
e66883b3
RK
99 color: pvar(--inputForegroundColor);
100 background-color: pvar(--inputBackgroundColor);
a3345972 101 border: 1px solid pvar(--inputBorderColor);
c30745f3 102 border-radius: 3px;
5b0ec7cd
C
103 font-size: $form-input-font-size;
104 line-height: $form-input-line-height;
9a0fc840
RK
105
106 &::placeholder {
e66883b3 107 color: pvar(--inputPlaceholderColor);
9a0fc840 108 }
2860e62e 109
767bb14a
C
110 &[readonly] {
111 opacity: 0.7;
112 }
113
5c16e6bc 114 @media screen and (max-width: calc(#{$width} + 40px)) {
2860e62e
C
115 width: 100%;
116 }
8a19bee1 117}
c30745f3 118
5f0805d3
C
119@mixin peertube-textarea ($width, $height) {
120 @include peertube-input-text($width);
121
b788e691
C
122 color: pvar(--textareaForegroundColor) !important;
123 background-color: pvar(--textareaBackgroundColor) !important;
5f0805d3
C
124 height: $height;
125 padding: 5px 15px;
5f0805d3
C
126}
127
7b272fd7 128@mixin orange-button {
e66883b3 129 @include button-focus(pvar(--mainColorLightest));
e40afb5b 130
931d3430
C
131 &,
132 &:active,
133 &:focus {
15a7387d 134 color: #fff;
e66883b3 135 background-color: pvar(--mainColor);
15a7387d 136 }
7b272fd7 137
15a7387d 138 &:hover {
0727cab0 139 color: #fff;
e66883b3 140 background-color: pvar(--mainHoverColor);
7b272fd7 141 }
4cc66133 142
931d3430
C
143 &[disabled],
144 &.disabled {
4cc66133 145 cursor: default;
cadb46d8 146 color: #fff;
a3345972 147 background-color: pvar(--inputBorderColor);
4cc66133 148 }
457bb213
C
149
150 my-global-icon {
931d3430 151 @include apply-svg-color(#fff);
457bb213 152 }
7b272fd7
C
153}
154
60c35932
C
155@mixin orange-button-inverted {
156 @include button-focus(pvar(--mainColorLightest));
157
158 border: 2px solid pvar(--mainColor);
733dbc53 159 font-weight: $font-semibold;
60c35932 160
931d3430
C
161 &,
162 &:active,
163 &:focus {
60c35932
C
164 color: pvar(--mainColor);
165 background-color: pvar(--mainBackgroundColor);
166 }
167
168 &:hover {
169 color: pvar(--mainColor);
170 background-color: pvar(--mainColorLightest);
171 }
172
931d3430
C
173 &[disabled],
174 &.disabled {
60c35932
C
175 cursor: default;
176 color: pvar(--mainColor);
a3345972 177 background-color: pvar(--inputBorderColor);
60c35932
C
178 }
179
180 my-global-icon {
931d3430 181 @include apply-svg-color(pvar(--mainColor));
60c35932
C
182 }
183}
184
54e78847 185@mixin tertiary-button {
a6d5ff76
RK
186 @include button-focus($grey-button-outline-color);
187
e66883b3 188 color: pvar(--greyForegroundColor);
54e78847
RK
189 background-color: transparent;
190
931d3430
C
191 &[disabled],
192 .disabled {
54e78847
RK
193 cursor: default;
194 }
195
196 my-global-icon {
931d3430 197 @include apply-svg-color(transparent);
54e78847
RK
198 }
199}
200
7b272fd7 201@mixin grey-button {
a6d5ff76 202 @include button-focus($grey-button-outline-color);
26171379 203
b788e691 204 background-color: pvar(--greyBackgroundColor);
1fe1e14c 205 color: pvar(--greyForegroundColor);
7b272fd7 206
931d3430
C
207 &:hover,
208 &:active,
209 &:focus,
210 &[disabled],
211 &.disabled {
e66883b3 212 color: pvar(--greyForegroundColor);
b788e691 213 background-color: pvar(--greySecondaryBackgroundColor);
7b272fd7 214 }
4cc66133 215
931d3430
C
216 &[disabled],
217 &.disabled {
4cc66133
C
218 cursor: default;
219 }
457bb213
C
220
221 my-global-icon {
931d3430 222 @include apply-svg-color(pvar(--greyForegroundColor));
457bb213 223 }
7b272fd7
C
224}
225
1fe1e14c
RK
226@mixin danger-button {
227 $color: lighten($color: #c54130, $amount: 10);
228 $text: #fff6f5;
229
230 @include button-focus(scale-color($color, $alpha: -95%));
931d3430 231
1fe1e14c
RK
232 background-color: $color;
233 color: $text;
234
931d3430
C
235 &:hover,
236 &:active,
237 &:focus,
238 &[disabled],
239 &.disabled {
1fe1e14c
RK
240 background-color: lighten($color: $color, $amount: 10);
241 }
242
931d3430
C
243 &[disabled],
244 &.disabled {
1fe1e14c
RK
245 cursor: default;
246 }
247
248 my-global-icon {
931d3430 249 @include apply-svg-color($text);
1fe1e14c
RK
250 }
251}
252
c30745f3 253@mixin peertube-button {
420a6043 254 padding: 4px 13px;
27bc9586 255
931d3430 256 border: 0;
c30745f3 257 font-weight: $font-semibold;
02b2e482
C
258
259 // Because of primeng that redefines border-radius of all input[type="..."]
266947e5 260 border-radius: 3px !important;
02b2e482 261
c30745f3 262 text-align: center;
c30745f3 263 cursor: pointer;
419b520c 264
5b0ec7cd
C
265 font-size: $button-font-size;
266
419b520c
C
267 my-global-icon + * {
268 @include margin-right(4px);
420a6043 269 @include margin-left(4px);
419b520c 270 }
c30745f3
C
271}
272
6f03f944
C
273@mixin peertube-button-big {
274 height: auto;
275 padding: 10px 25px;
276 font-size: 18px;
277 line-height: 1.2;
278 border: 0;
279 font-weight: $font-semibold;
280
281 // Because of primeng that redefines border-radius of all input[type="..."]
282 border-radius: 3px !important;
283}
284
c30745f3 285@mixin peertube-button-link {
c30745f3 286 @include disable-default-a-behaviour;
ce0e281d 287 @include peertube-button;
2295ce6c 288
aa0f1963 289 display: inline-block;
931d3430 290}
aa0f1963 291
c0e3d9ff
C
292@mixin peertube-button-big-link {
293 @include disable-default-a-behaviour;
294 @include peertube-button-big;
295
296 display: inline-block;
297}
298
931d3430 299@mixin peertube-button-outline {
aa0f1963
RK
300 @include disable-default-a-behaviour;
301 @include peertube-button;
302
931d3430 303 display: inline-block;
aa0f1963
RK
304 border: 1px solid;
305}
306
457bb213
C
307@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) {
308 my-global-icon {
27bc9586
C
309 @include margin-right($margin-right);
310
457bb213
C
311 position: relative;
312 width: $width;
457bb213
C
313 top: $top;
314 }
315}
316
1ea7da81 317@mixin peertube-file {
c5911fd3
C
318 position: relative;
319 overflow: hidden;
320 display: inline-block;
c5911fd3 321
c5911fd3
C
322 input[type=file] {
323 position: absolute;
324 top: 0;
325 right: 0;
e61151b0
RK
326 width: 100%;
327 height: 100%;
c5911fd3 328 font-size: 100px;
27bc9586 329 text-align: end;
c5911fd3
C
330 filter: alpha(opacity=0);
331 opacity: 0;
332 outline: none;
420a6043 333 background: pvar(--mainBackgroundColor);
c5911fd3
C
334 cursor: inherit;
335 display: block;
336 }
337}
338
1ea7da81 339@mixin peertube-button-file ($width) {
1ea7da81
RK
340 @include peertube-file;
341 @include peertube-button;
931d3430
C
342
343 width: $width;
1ea7da81
RK
344}
345
0727cab0
C
346@mixin icon ($size) {
347 display: inline-block;
348 background-repeat: no-repeat;
349 background-size: contain;
350 width: $size;
351 height: $size;
352 vertical-align: middle;
353 cursor: pointer;
354}
4cc66133 355
d89fcd1e
C
356@mixin responsive-width ($width) {
357 width: $width;
358
359 @media screen and (max-width: $width) {
360 width: 100%;
361 }
362}
52c4976f 363
15a7387d
C
364@mixin peertube-select-container ($width) {
365 padding: 0;
366 margin: 0;
4cc66133
C
367 width: $width;
368 border-radius: 3px;
e66883b3
RK
369 color: pvar(--inputForegroundColor);
370 background: pvar(--inputBackgroundColor);
15a7387d 371 position: relative;
ebe9b6b3 372 height: min-content;
15a7387d 373
2f4c784a
C
374 &.disabled {
375 background-color: #E5E5E5;
376
377 select {
378 cursor: default;
379 }
380 }
4c8749cb 381
8d8a037e
JB
382 select[disabled] {
383 background-color: #f9f9f9;
384 }
2f4c784a 385
2c3abc4f
C
386 @media screen and (max-width: $width) {
387 width: 100%;
388 }
389
931d3430 390 &::after {
bc4c9cc1
C
391 top: 50%;
392 right: calc(0% + 15px);
393 content: ' ';
394 height: 0;
395 width: 0;
396 position: absolute;
397 pointer-events: none;
398 border: 5px solid rgba(0, 0, 0, 0);
dec437aa 399 border-top-color: pvar(--mainForegroundColor);
bc4c9cc1
C
400 margin-top: -2px;
401 z-index: 100;
15a7387d
C
402 }
403
404 select {
d9a37011 405 padding: 4px 35px 4px 12px;
15a7387d 406 position: relative;
a3345972 407 border: 1px solid pvar(--inputBorderColor);
15a7387d
C
408 background: transparent none;
409 appearance: none;
108af661 410 text-overflow: ellipsis;
e66883b3 411 color: pvar(--mainForegroundColor);
5b0ec7cd
C
412 font-size: $form-input-font-size;
413 line-height: $form-input-line-height;
15a7387d
C
414
415 &:focus {
416 outline: none;
417 }
418
419 &:-moz-focusring {
420 color: transparent;
421 text-shadow: 0 0 0 #000;
422 }
aa879092
C
423
424 option {
425 color: #000;
4c0b4a08
C
426
427 &[value=undefined] {
428 font-weight: $font-semibold;
429 }
aa879092 430 }
15a7387d 431 }
654a188f
RK
432
433 &.peertube-select-button {
434 @include grey-button;
435
4c0b4a08 436 select {
654a188f
RK
437 font-weight: $font-semibold;
438 color: pvar(--greyForegroundColor);
931d3430 439 border: 0;
654a188f
RK
440 }
441 }
15a7387d
C
442}
443
dd24f1bb 444// Thanks: https://codepen.io/manabox/pen/raQmpL
5f0805d3 445@mixin peertube-radio-container {
5b0ec7cd
C
446 label {
447 font-size: $form-input-font-size;
448 }
449
dd24f1bb
C
450 [type=radio]:checked,
451 [type=radio]:not(:checked) {
452 position: absolute;
e4d9696a
C
453 opacity: 0;
454 cursor: pointer;
455 height: 0;
456 width: 0;
dd24f1bb 457 }
5f0805d3 458
dd24f1bb
C
459 [type=radio]:checked + label,
460 [type=radio]:not(:checked) + label {
461 position: relative;
462 padding-left: 28px;
463 cursor: pointer;
464 line-height: 20px;
465 display: inline-block;
3eb7ee65 466 font-weight: $font-regular;
dd24f1bb 467 }
5f0805d3 468
dd24f1bb
C
469 [type=radio]:checked + label::before,
470 [type=radio]:not(:checked) + label::before {
471 content: '';
472 position: absolute;
473 left: 0;
474 top: 0;
475 width: 18px;
476 height: 18px;
a3345972 477 border: 1px solid pvar(--inputBorderColor);
dd24f1bb
C
478 border-radius: 100%;
479 background: #fff;
480 }
481
482 [type=radio]:checked + label::after,
483 [type=radio]:not(:checked) + label::after {
484 content: '';
485 width: 10px;
486 height: 10px;
487 background: pvar(--mainColor);
488 position: absolute;
489 top: 4px;
490 left: 4px;
491 border-radius: 100%;
492 transition: all 0.2s ease;
493 }
494 [type=radio]:not(:checked) + label::after {
495 opacity: 0;
496 transform: scale(0);
497 }
498 [type=radio]:checked + label::after {
499 opacity: 1;
500 transform: scale(1);
5f0805d3 501 }
3eb7ee65
C
502
503 .form-group-description {
504 display: block;
1e2fe802 505 margin-top: -7px;
3eb7ee65
C
506 margin-bottom: 10px;
507 margin-left: 29px;
508 }
5f0805d3
C
509}
510
a0d69908 511@mixin peertube-checkbox ($border-width) {
1d5342ab 512 opacity: 0;
776ca9b1 513 position: absolute;
1d5342ab
C
514
515 &:focus + span {
e66883b3 516 box-shadow: #{$focus-box-shadow-form} pvar(--mainColorLightest);
1d5342ab 517 }
a0d69908 518
931d3430 519 + span {
a0d69908
C
520 position: relative;
521 width: 18px;
bc20aaed 522 min-width: 18px;
a0d69908 523 height: 18px;
a3345972 524 border: $border-width solid pvar(--inputBorderColor);
a0d69908
C
525 border-radius: 3px;
526 vertical-align: middle;
527 cursor: pointer;
528
931d3430 529 &::after {
a0d69908
C
530 content: '';
531 position: absolute;
532 top: calc(2px - #{$border-width});
533 left: 5px;
534 width: 5px;
535 height: 12px;
536 opacity: 0;
537 transform: rotate(45deg) scale(0);
b4e55614
B
538 border-right: 2px solid pvar(--mainBackgroundColor);
539 border-bottom: 2px solid pvar(--mainBackgroundColor);
a0d69908
C
540 }
541 }
542
0f7fedc3 543 &:checked + span {
a0d69908 544 border-color: transparent;
e66883b3 545 background: pvar(--mainColor);
a0d69908
C
546 animation: jelly 0.6s ease;
547
931d3430 548 &::after {
a0d69908
C
549 opacity: 1;
550 transform: rotate(45deg) scale(1);
551 }
552 }
553
931d3430 554 + span + span {
27bc9586
C
555 @include margin-left(5px);
556
a0d69908 557 font-weight: $font-regular;
a0d69908 558 cursor: pointer;
6693df9d 559 display: inline;
a0d69908 560 }
bbe0f064 561
0f7fedc3 562 &[disabled] + span,
931d3430 563 &[disabled] + span + span {
bbe0f064
C
564 opacity: 0.5;
565 cursor: default;
566 }
a0d69908
C
567}
568
746018f6
C
569@mixin actor-avatar-size ($size) {
570 display: inline-block;
60c35932
C
571 width: $size;
572 height: $size;
573 min-width: $size;
574 min-height: $size;
575}
576
61cbafc1
C
577@mixin actor-counters ($separator-margin: 10px) {
578 color: pvar(--greyForegroundColor);
61cbafc1
C
579 display: flex;
580 align-items: center;
581
582 > *:not(:last-child)::after {
583 content: '•';
584 margin: 0 $separator-margin;
585 color: pvar(--mainColor);
586 }
587}
588
0626e7af
C
589@mixin in-content-small-title {
590 text-transform: uppercase;
e66883b3 591 color: pvar(--mainColor);
0626e7af
C
592 font-weight: $font-bold;
593 font-size: 13px;
170726f5
C
594}
595
482fa503
RK
596@mixin settings-big-title {
597 text-transform: uppercase;
e66883b3 598 color: pvar(--mainColor);
482fa503 599 font-weight: $font-bold;
5b0ec7cd 600 font-size: 1rem;
482fa503
RK
601 margin-bottom: 10px;
602}
603
457bb213 604@mixin create-button {
08c1efbe
C
605 @include peertube-button-link;
606 @include orange-button;
457bb213 607 @include button-with-icon(20px, 5px, -1px);
a4f99a76 608}
22a16e36 609
4beda9e1 610@mixin row-blocks ($column-responsive: true, $min-height: 130px, $separator: true) {
22a16e36 611 display: flex;
4beda9e1 612 min-height: $min-height;
22a16e36
C
613 padding-bottom: 20px;
614 margin-bottom: 20px;
4beda9e1
C
615
616 @if $separator {
a3345972 617 border-bottom: 1px solid pvar(--inputBorderColor);
4beda9e1 618 }
22a16e36 619
0f7407d9
C
620 @media screen and (max-width: $small-view) {
621 @if $column-responsive {
622 flex-direction: column;
623 height: auto;
624 align-items: center;
625 } @else {
626 min-height: initial;
627 padding-bottom: 10px;
628 margin-bottom: 10px;
629 }
22a16e36 630 }
6aff854c 631}
c5a1ae50
C
632
633@mixin dropdown-with-icon-item {
bc584963 634 padding: 6px 15px;
c5a1ae50
C
635
636 my-global-icon {
27bc9586
C
637 @include margin-right(10px);
638
bc584963
RK
639 width: 22px;
640 opacity: .7;
c5a1ae50
C
641 position: relative;
642 top: -2px;
643 }
644}
e61151b0 645
66927c05 646@mixin progressbar($small: false) {
dec437aa 647 background-color: pvar(--greyBackgroundColor);
e61151b0
RK
648 display: flex;
649 height: 1rem;
650 overflow: hidden;
651 font-size: 0.75rem;
652 border-radius: 0.25rem;
bc99dfe5
RK
653 position: relative;
654
655 span {
656 position: absolute;
dec437aa 657 color: pvar(--greyForegroundColor);
d94b8ecf 658
66927c05
RK
659 @if $small {
660 top: -1px;
661 }
bc99dfe5
RK
662
663 &:nth-of-type(1) {
664 left: .2rem;
665 }
666 &:nth-of-type(2) {
667 right: .2rem;
668 }
669 }
e61151b0
RK
670
671 .progress-bar {
e66883b3
RK
672 color: pvar(--mainBackgroundColor);
673 background-color: pvar(--mainColor);
e61151b0
RK
674 display: flex;
675 flex-direction: column;
676 justify-content: center;
677 text-align: center;
678 white-space: nowrap;
679 transition: width 0.6s ease;
680
d4132d3f
RK
681 &.red {
682 background-color: lighten($color: #c54130, $amount: 10);
683 }
e61151b0
RK
684 }
685}
76314386
RK
686
687@mixin breadcrumb {
688 display: flex;
689 flex-wrap: wrap;
5b0ec7cd 690 padding: 0;
76314386
RK
691 margin-bottom: 1rem;
692 list-style: none;
5b0ec7cd 693 font-weight: $font-semibold;
76314386
RK
694
695 .breadcrumb-item {
696 display: flex;
697
698 a {
e66883b3 699 color: pvar(--mainColor);
76314386
RK
700 }
701
931d3430 702 + .breadcrumb-item {
27bc9586
C
703 @include padding-left(0.5rem);
704
76314386 705 &::before {
27bc9586
C
706 @include padding-right(0.5rem);
707
76314386 708 display: inline-block;
76314386 709 color: #6c757d;
931d3430 710 content: '/';
76314386
RK
711 }
712 }
713
714 &.active {
715 color: #6c757d;
716 }
717 }
718}
719
720@mixin dashboard {
721 display: flex;
722 flex-wrap: wrap;
723 margin: 0 -5px;
724
931d3430 725 > div {
76314386 726 box-sizing: border-box;
8cbc40b2 727 flex: 0 0 percentage(math.div(1, 3));
76314386
RK
728 padding: 0 5px;
729 margin-bottom: 10px;
730
931d3430 731 > a {
d1261d9a
RK
732 @include disable-default-a-behaviour;
733
76314386
RK
734 text-decoration: none;
735 color: inherit;
736 display: block;
737 font-size: 18px;
738
739 &:active,
740 &:focus,
741 &:hover {
742 opacity: .8;
743 }
744 }
745
931d3430
C
746 > a,
747 > div {
76314386 748 padding: 20px;
218f730c 749 background: pvar(--submenuBackgroundColor);
76314386
RK
750 border-radius: 4px;
751 box-sizing: border-box;
752 height: 100%;
753 }
754 }
755
931d3430
C
756 .dashboard-num,
757 .dashboard-text {
76314386
RK
758 text-align: center;
759 font-size: 130%;
e66883b3 760 color: pvar(--mainForegroundColor);
76314386
RK
761 line-height: 30px;
762 margin-bottom: 20px;
763 }
764
765 .dashboard-label {
766 font-size: 90%;
e66883b3 767 color: pvar(--inputPlaceholderColor);
76314386
RK
768 text-align: center;
769 }
770}
a6d5ff76 771
218f730c 772@mixin divider($color: pvar(--submenuBackgroundColor), $background: pvar(--mainBackgroundColor)) {
b515c98c
RK
773 width: 95%;
774 border-top: .05rem solid $color;
775 height: .05rem;
776 text-align: center;
777 display: block;
778 position: relative;
779
780 &[data-content] {
781 margin: .8rem 0;
782
783 &::after {
784 background: $background;
785 color: $color;
786 content: attr(data-content);
787 display: inline-block;
788 font-size: .7rem;
789 padding: 0 .4rem;
790 transform: translateY(-.65rem);
791 }
792 }
793}
d6af8146
RK
794
795@mixin chip {
9589907c 796 --avatar-size: 1.2rem;
d6af8146 797
d6af8146 798 display: inline-flex;
e66883b3 799 color: pvar(--mainForegroundColor);
9589907c 800 height: var(--avatar-size);
d6af8146
RK
801 max-width: 320px;
802 overflow: hidden;
d6af8146
RK
803 text-decoration: none;
804 text-overflow: ellipsis;
805 vertical-align: middle;
806 white-space: nowrap;
807
f6e98f0a 808 my-actor-avatar {
27bc9586 809 @include margin-right(.2rem);
9589907c
C
810
811 border-radius: 5rem;
812 width: var(--avatar-size);
813 height: var(--avatar-size);
d6af8146
RK
814 }
815
816 &.two-lines {
9589907c 817 --avatar-size: 2rem;
d6af8146 818
9589907c
C
819 font-size: 14px;
820 line-height: 1rem;
d6af8146 821
f6e98f0a 822 my-actor-avatar {
d0800f76 823 display: inline-block;
d6af8146
RK
824 }
825
9589907c 826 > div {
d6af8146
RK
827 display: flex;
828 flex-direction: column;
d6af8146
RK
829 justify-content: center;
830 }
831 }
832}
7a03209d 833
cdeddff1
C
834// applies ratio (default to 16:9) to a child element (using $selector) only using
835// an immediate's parent size. This allows to set a ratio without explicit
e66883b3 836// dimensions, as width/height cannot be computed from each other.
8cbc40b2 837@mixin block-ratio ($selector: 'div', $inverted-ratio: math.div(9, 16)) {
cdeddff1
C
838 $padding-percent: percentage($inverted-ratio);
839
e66883b3
RK
840 position: relative;
841 height: 0;
842 width: 100%;
cdeddff1 843 padding-top: $padding-percent;
e66883b3
RK
844
845 #{$selector} {
846 position: absolute;
847 width: 100%;
848 height: 100%;
849 top: 0;
37a44fc9 850
e66883b3
RK
851 @content;
852 }
853}
ed5bb517
K
854
855@mixin sub-menu-h1 {
856 ::ng-deep h1 {
857 font-size: 1.3rem;
858 border-bottom: 2px solid $grey-background-color;
859 padding-bottom: 15px;
860 margin-bottom: $sub-menu-margin-bottom;
861
cd262619 862 > span > my-global-icon,
205e4f56 863 > my-global-icon {
27bc9586 864 @include margin-right(10px);
ed5bb517
K
865 width: 24px;
866 height: 24px;
cd262619 867 vertical-align: top;
ed5bb517
K
868 }
869
4c8749cb 870 .pt-badge {
27bc9586 871 @include margin-left(7px);
4c8749cb 872
cd262619 873 vertical-align: top;
ed5bb517
K
874 }
875 }
876}
4572c3d0
C
877
878@mixin play-icon ($width, $height) {
879 width: 0;
880 height: 0;
881
882 position: absolute;
883 left: 50%;
884 top: 50%;
885 transform: translate(-50%, -50%) scale(0.5);
886
8cbc40b2
C
887 border-top: #{math.div($height, 2)} solid transparent;
888 border-bottom: #{math.div($height, 2)} solid transparent;
4572c3d0
C
889
890 border-left: $width solid rgba(255, 255, 255, 0.95);
891}
0f7407d9
C
892
893@mixin on-small-main-col () {
894 :host-context(.main-col:not(.expanded)) {
895 @media screen and (max-width: $small-view + $menu-width) {
896 @content;
897 }
898 }
899
900 :host-context(.main-col.expanded) {
901 @media screen and (max-width: $small-view) {
902 @content;
903 }
904 }
905}
906
907@mixin on-mobile-main-col () {
908 :host-context(.main-col:not(.expanded)) {
909 @media screen and (max-width: $mobile-view + $menu-width) {
910 @content;
911 }
912 }
913
914 :host-context(.main-col.expanded) {
915 @media screen and (max-width: $mobile-view) {
916 @content;
917 }
918 }
919}
27bc9586 920
4158e67c 921@mixin margin ($arg1: null, $arg2: null, $arg3: null, $arg4: null) {
7bbc062d 922 @if $arg2 == null and $arg3 == null and $arg4 == null {
4158e67c 923 @include margin-original($arg1, $arg1, $arg1, $arg1);
7bbc062d 924 } @else if $arg3 == null and $arg4 == null {
4158e67c 925 @include margin-original($arg1, $arg2, $arg1, $arg2);
7bbc062d 926 } @else if $arg4 == null {
4158e67c
W
927 @include margin-original($arg1, $arg2, $arg3, $arg2);
928 } @else {
929 @include margin-original($arg1, $arg2, $arg3, $arg4);
930 }
931}
932
933@mixin margin-original ($block-start, $inline-end, $block-end, $inline-start) {
27bc9586
C
934 @include margin-left($inline-start);
935 @include margin-right($inline-end);
27f84cc3
W
936 @include margin-top($block-start);
937 @include margin-bottom($block-end);
27bc9586
C
938}
939
27bc9586
C
940@mixin margin-left ($value) {
941 @supports (margin-inline-start: $value) {
27f84cc3 942 @include rfs($value, margin-inline-start);
27bc9586
C
943 }
944
945 @supports not (margin-inline-start: $value) {
27f84cc3 946 @include rfs($value, margin-left);
27bc9586
C
947 }
948}
949
950@mixin margin-right ($value) {
951 @supports (margin-inline-end: $value) {
27f84cc3 952 @include rfs($value, margin-inline-end);
27bc9586
C
953 }
954
955 @supports not (margin-inline-end: $value) {
27f84cc3 956 @include rfs($value, margin-right);
27bc9586
C
957 }
958}
959
4158e67c
W
960@mixin padding-original ($block-start, $inline-end, $block-end, $inline-start) {
961 @include padding-left($inline-start);
962 @include padding-right($inline-end);
963 @include padding-top($block-start);
964 @include padding-bottom($block-end);
965}
966
967
968@mixin padding ($arg1: null, $arg2: null, $arg3: null, $arg4: null) {
7bbc062d 969 @if $arg2 == null and $arg3 == null and $arg4 == null {
4158e67c 970 @include padding-original($arg1, $arg1, $arg1, $arg1);
7bbc062d 971 } @else if $arg3 == null and $arg4 == null {
4158e67c 972 @include padding-original($arg1, $arg2, $arg1, $arg2);
7bbc062d 973 } @else if $arg4 == null {
4158e67c
W
974 @include padding-original($arg1, $arg2, $arg3, $arg2);
975 } @else {
976 @include padding-original($arg1, $arg2, $arg3, $arg4);
977 }
978}
979
27bc9586
C
980@mixin padding-left ($value) {
981 @supports (padding-inline-start: $value) {
27f84cc3 982 @include rfs($value, padding-inline-start);
27bc9586
C
983 }
984
985 @supports not (padding-inline-start: $value) {
27f84cc3 986 @include rfs($value, padding-left);
27bc9586
C
987 }
988}
989
990@mixin padding-right ($value) {
991 @supports (padding-inline-end: $value) {
27f84cc3 992 @include rfs($value, padding-inline-end);
27bc9586
C
993 }
994
995 @supports not (padding-inline-end: $value) {
27f84cc3 996 @include rfs($value, padding-right);
27bc9586
C
997 }
998}