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