]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
Fix notification z-index with modals
[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);
bffee1d5 95 border: 1px solid $input-border-color;
c30745f3 96 border-radius: 3px;
17bb716b 97 font-size: 15px;
9a0fc840
RK
98
99 &::placeholder {
e66883b3 100 color: pvar(--inputPlaceholderColor);
9a0fc840 101 }
2860e62e 102
767bb14a
C
103 &[readonly] {
104 opacity: 0.7;
105 }
106
5c16e6bc 107 @media screen and (max-width: calc(#{$width} + 40px)) {
2860e62e
C
108 width: 100%;
109 }
8a19bee1 110}
c30745f3 111
5f0805d3
C
112@mixin peertube-textarea ($width, $height) {
113 @include peertube-input-text($width);
114
b788e691
C
115 color: pvar(--textareaForegroundColor) !important;
116 background-color: pvar(--textareaBackgroundColor) !important;
5f0805d3
C
117 height: $height;
118 padding: 5px 15px;
119 font-size: 15px;
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;
bffee1d5 141 background-color: $input-border-color;
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);
bffee1d5 171 background-color: $input-border-color;
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
C
251 font-weight: $font-semibold;
252 font-size: 15px;
253 height: $button-height;
254 line-height: $button-height;
02b2e482
C
255
256 // Because of primeng that redefines border-radius of all input[type="..."]
266947e5 257 border-radius: 3px !important;
02b2e482 258
c30745f3 259 text-align: center;
c30745f3 260 cursor: pointer;
419b520c
C
261
262 my-global-icon + * {
263 @include margin-right(4px);
264 }
c30745f3
C
265}
266
267@mixin peertube-button-link {
c30745f3 268 @include disable-default-a-behaviour;
ce0e281d 269 @include peertube-button;
2295ce6c 270
aa0f1963 271 display: inline-block;
931d3430 272}
aa0f1963 273
931d3430 274@mixin peertube-button-outline {
aa0f1963
RK
275 @include disable-default-a-behaviour;
276 @include peertube-button;
277
931d3430 278 display: inline-block;
aa0f1963
RK
279 border: 1px solid;
280}
281
457bb213 282@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) {
26171379
C
283 display: inline-flex;
284 align-items: center;
285 line-height: normal !important;
286
457bb213 287 my-global-icon {
27bc9586
C
288 @include margin-right($margin-right);
289
457bb213
C
290 position: relative;
291 width: $width;
457bb213
C
292 top: $top;
293 }
294}
295
1ea7da81 296@mixin peertube-file {
c5911fd3
C
297 position: relative;
298 overflow: hidden;
299 display: inline-block;
e61151b0 300 min-height: 30px;
c5911fd3 301
c5911fd3
C
302 input[type=file] {
303 position: absolute;
304 top: 0;
305 right: 0;
e61151b0
RK
306 width: 100%;
307 height: 100%;
c5911fd3 308 font-size: 100px;
27bc9586 309 text-align: end;
c5911fd3
C
310 filter: alpha(opacity=0);
311 opacity: 0;
312 outline: none;
931d3430 313 background: #fff;
c5911fd3
C
314 cursor: inherit;
315 display: block;
316 }
317}
318
1ea7da81 319@mixin peertube-button-file ($width) {
1ea7da81
RK
320 @include peertube-file;
321 @include peertube-button;
931d3430
C
322
323 width: $width;
1ea7da81
RK
324}
325
0727cab0
C
326@mixin icon ($size) {
327 display: inline-block;
328 background-repeat: no-repeat;
329 background-size: contain;
330 width: $size;
331 height: $size;
332 vertical-align: middle;
333 cursor: pointer;
334}
4cc66133 335
d89fcd1e
C
336@mixin responsive-width ($width) {
337 width: $width;
338
339 @media screen and (max-width: $width) {
340 width: 100%;
341 }
342}
52c4976f 343
15a7387d
C
344@mixin peertube-select-container ($width) {
345 padding: 0;
346 margin: 0;
4cc66133
C
347 width: $width;
348 border-radius: 3px;
e66883b3
RK
349 color: pvar(--inputForegroundColor);
350 background: pvar(--inputBackgroundColor);
15a7387d 351 position: relative;
5f0805d3 352 font-size: 15px;
ebe9b6b3 353 height: min-content;
15a7387d 354
2f4c784a
C
355 &.disabled {
356 background-color: #E5E5E5;
357
358 select {
359 cursor: default;
360 }
361 }
4c8749cb 362
8d8a037e
JB
363 select[disabled] {
364 background-color: #f9f9f9;
365 }
2f4c784a 366
2c3abc4f
C
367 @media screen and (max-width: $width) {
368 width: 100%;
369 }
370
931d3430 371 &::after {
bc4c9cc1
C
372 top: 50%;
373 right: calc(0% + 15px);
374 content: ' ';
375 height: 0;
376 width: 0;
377 position: absolute;
378 pointer-events: none;
379 border: 5px solid rgba(0, 0, 0, 0);
380 border-top-color: #000;
381 margin-top: -2px;
382 z-index: 100;
15a7387d
C
383 }
384
385 select {
108af661 386 padding: 0 35px 0 12px;
15a7387d 387 position: relative;
bffee1d5 388 border: 1px solid $input-border-color;
15a7387d
C
389 background: transparent none;
390 appearance: none;
15a7387d 391 height: $button-height;
108af661 392 text-overflow: ellipsis;
e66883b3 393 color: pvar(--mainForegroundColor);
15a7387d
C
394
395 &:focus {
396 outline: none;
397 }
398
399 &:-moz-focusring {
400 color: transparent;
401 text-shadow: 0 0 0 #000;
402 }
aa879092
C
403
404 option {
405 color: #000;
4c0b4a08
C
406
407 &[value=undefined] {
408 font-weight: $font-semibold;
409 }
aa879092 410 }
15a7387d 411 }
654a188f
RK
412
413 &.peertube-select-button {
414 @include grey-button;
415
4c0b4a08 416 select {
654a188f
RK
417 font-weight: $font-semibold;
418 color: pvar(--greyForegroundColor);
931d3430 419 border: 0;
654a188f
RK
420 }
421 }
15a7387d
C
422}
423
dd24f1bb 424// Thanks: https://codepen.io/manabox/pen/raQmpL
5f0805d3 425@mixin peertube-radio-container {
dd24f1bb
C
426 [type=radio]:checked,
427 [type=radio]:not(:checked) {
428 position: absolute;
429 left: -9999px;
430 }
5f0805d3 431
dd24f1bb
C
432 [type=radio]:checked + label,
433 [type=radio]:not(:checked) + label {
434 position: relative;
435 padding-left: 28px;
436 cursor: pointer;
437 line-height: 20px;
438 display: inline-block;
3eb7ee65
C
439 font-size: 15px;
440 font-weight: $font-regular;
dd24f1bb 441 }
5f0805d3 442
dd24f1bb
C
443 [type=radio]:checked + label::before,
444 [type=radio]:not(:checked) + label::before {
445 content: '';
446 position: absolute;
447 left: 0;
448 top: 0;
449 width: 18px;
450 height: 18px;
bffee1d5 451 border: 1px solid $input-border-color;
dd24f1bb
C
452 border-radius: 100%;
453 background: #fff;
454 }
455
456 [type=radio]:checked + label::after,
457 [type=radio]:not(:checked) + label::after {
458 content: '';
459 width: 10px;
460 height: 10px;
461 background: pvar(--mainColor);
462 position: absolute;
463 top: 4px;
464 left: 4px;
465 border-radius: 100%;
466 transition: all 0.2s ease;
467 }
468 [type=radio]:not(:checked) + label::after {
469 opacity: 0;
470 transform: scale(0);
471 }
472 [type=radio]:checked + label::after {
473 opacity: 1;
474 transform: scale(1);
5f0805d3 475 }
3eb7ee65
C
476
477 .form-group-description {
478 display: block;
1e2fe802 479 margin-top: -7px;
3eb7ee65
C
480 margin-bottom: 10px;
481 margin-left: 29px;
482 }
5f0805d3
C
483}
484
a0d69908 485@mixin peertube-checkbox ($border-width) {
1d5342ab 486 opacity: 0;
776ca9b1 487 position: absolute;
1d5342ab
C
488
489 &:focus + span {
e66883b3 490 box-shadow: #{$focus-box-shadow-form} pvar(--mainColorLightest);
1d5342ab 491 }
a0d69908 492
931d3430 493 + span {
a0d69908
C
494 position: relative;
495 width: 18px;
bc20aaed 496 min-width: 18px;
a0d69908 497 height: 18px;
bffee1d5 498 border: $border-width solid $input-border-color;
a0d69908
C
499 border-radius: 3px;
500 vertical-align: middle;
501 cursor: pointer;
502
931d3430 503 &::after {
a0d69908
C
504 content: '';
505 position: absolute;
506 top: calc(2px - #{$border-width});
507 left: 5px;
508 width: 5px;
509 height: 12px;
510 opacity: 0;
511 transform: rotate(45deg) scale(0);
18c97728
C
512 border-right: 2px solid $bg-color;
513 border-bottom: 2px solid $bg-color;
a0d69908
C
514 }
515 }
516
0f7fedc3 517 &:checked + span {
a0d69908 518 border-color: transparent;
e66883b3 519 background: pvar(--mainColor);
a0d69908
C
520 animation: jelly 0.6s ease;
521
931d3430 522 &::after {
a0d69908
C
523 opacity: 1;
524 transform: rotate(45deg) scale(1);
525 }
526 }
527
931d3430 528 + span + span {
27bc9586
C
529 @include margin-left(5px);
530
a0d69908
C
531 font-size: 15px;
532 font-weight: $font-regular;
a0d69908 533 cursor: pointer;
6693df9d 534 display: inline;
a0d69908 535 }
bbe0f064 536
0f7fedc3 537 &[disabled] + span,
931d3430 538 &[disabled] + span + span {
bbe0f064
C
539 opacity: 0.5;
540 cursor: default;
541 }
a0d69908
C
542}
543
746018f6
C
544@mixin actor-avatar-size ($size) {
545 display: inline-block;
60c35932
C
546 width: $size;
547 height: $size;
548 min-width: $size;
549 min-height: $size;
550}
551
61cbafc1
C
552@mixin actor-counters ($separator-margin: 10px) {
553 color: pvar(--greyForegroundColor);
554 font-size: 16px;
555 display: flex;
556 align-items: center;
557
558 > *:not(:last-child)::after {
559 content: '•';
560 margin: 0 $separator-margin;
561 color: pvar(--mainColor);
562 }
563}
564
c6352f2c
C
565@mixin chevron ($size, $border-width) {
566 border-style: solid;
567 border-width: $border-width $border-width 0 0;
568 content: '';
569 display: inline-block;
570 transform: rotate(-45deg);
571 height: $size;
572 width: $size;
573}
574
575@mixin chevron-right ($size, $border-width) {
576 @include chevron($size, $border-width);
577
578 left: 0;
579 transform: rotate(45deg);
580}
581
582@mixin chevron-left ($size, $border-width) {
583 @include chevron($size, $border-width);
584
585 left: 0.25em;
586 transform: rotate(-135deg);
587}
0626e7af
C
588
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
RK
599 font-weight: $font-bold;
600 font-size: 110%;
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 {
bffee1d5 617 border-bottom: 1px solid $input-border-color;
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) {
e61151b0
RK
647 background-color: $grey-background-color;
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;
4f5d0459 657 color: $grey-foreground-color;
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;
690 padding: 0.75rem 1rem;
691 margin-bottom: 1rem;
692 list-style: none;
218f730c 693 background-color: pvar(--submenuBackgroundColor);
76314386
RK
694 border-radius: 0.25rem;
695
696 .breadcrumb-item {
697 display: flex;
698
699 a {
e66883b3 700 color: pvar(--mainColor);
76314386
RK
701 }
702
931d3430 703 + .breadcrumb-item {
27bc9586
C
704 @include padding-left(0.5rem);
705
76314386 706 &::before {
27bc9586
C
707 @include padding-right(0.5rem);
708
76314386 709 display: inline-block;
76314386 710 color: #6c757d;
931d3430 711 content: '/';
76314386
RK
712 }
713 }
714
715 &.active {
716 color: #6c757d;
717 }
718 }
719}
720
721@mixin dashboard {
722 display: flex;
723 flex-wrap: wrap;
724 margin: 0 -5px;
725
931d3430 726 > div {
76314386 727 box-sizing: border-box;
8cbc40b2 728 flex: 0 0 percentage(math.div(1, 3));
76314386
RK
729 padding: 0 5px;
730 margin-bottom: 10px;
731
931d3430 732 > a {
d1261d9a
RK
733 @include disable-default-a-behaviour;
734
76314386
RK
735 text-decoration: none;
736 color: inherit;
737 display: block;
738 font-size: 18px;
739
740 &:active,
741 &:focus,
742 &:hover {
743 opacity: .8;
744 }
745 }
746
931d3430
C
747 > a,
748 > div {
76314386 749 padding: 20px;
218f730c 750 background: pvar(--submenuBackgroundColor);
76314386
RK
751 border-radius: 4px;
752 box-sizing: border-box;
753 height: 100%;
754 }
755 }
756
931d3430
C
757 .dashboard-num,
758 .dashboard-text {
76314386
RK
759 text-align: center;
760 font-size: 130%;
e66883b3 761 color: pvar(--mainForegroundColor);
76314386
RK
762 line-height: 30px;
763 margin-bottom: 20px;
764 }
765
766 .dashboard-label {
767 font-size: 90%;
e66883b3 768 color: pvar(--inputPlaceholderColor);
76314386
RK
769 text-align: center;
770 }
771}
a6d5ff76 772
218f730c 773@mixin divider($color: pvar(--submenuBackgroundColor), $background: pvar(--mainBackgroundColor)) {
b515c98c
RK
774 width: 95%;
775 border-top: .05rem solid $color;
776 height: .05rem;
777 text-align: center;
778 display: block;
779 position: relative;
780
781 &[data-content] {
782 margin: .8rem 0;
783
784 &::after {
785 background: $background;
786 color: $color;
787 content: attr(data-content);
788 display: inline-block;
789 font-size: .7rem;
790 padding: 0 .4rem;
791 transform: translateY(-.65rem);
792 }
793 }
794}
d6af8146
RK
795
796@mixin chip {
1ebddadd
RK
797 --chip-radius: 5rem;
798 --chip-padding: .2rem .4rem;
d6af8146
RK
799 $avatar-height: 1.2rem;
800
801 align-items: center;
1ebddadd 802 border-radius: var(--chip-radius);
d6af8146
RK
803 display: inline-flex;
804 font-size: 90%;
e66883b3 805 color: pvar(--mainForegroundColor);
d6af8146 806 height: $avatar-height;
06827932 807 line-height: 1rem;
d6af8146
RK
808 margin: .1rem;
809 max-width: 320px;
810 overflow: hidden;
1ebddadd 811 padding: var(--chip-padding);
d6af8146
RK
812 text-decoration: none;
813 text-overflow: ellipsis;
814 vertical-align: middle;
815 white-space: nowrap;
816
1ebddadd
RK
817 &.rectangular {
818 --chip-radius: .2rem;
819 --chip-padding: .2rem .3rem;
820 }
821
f6e98f0a 822 my-actor-avatar {
27bc9586
C
823 @include margin-left(-.4rem);
824 @include margin-right(.2rem);
d6af8146
RK
825 }
826
827 &.two-lines {
36f772fd 828 $avatar-height: 2rem;
d6af8146
RK
829
830 height: $avatar-height;
831
f6e98f0a 832 my-actor-avatar {
d0800f76 833 display: inline-block;
d6af8146
RK
834 }
835
836 div {
27bc9586
C
837 margin: 0 .1rem;
838
d6af8146
RK
839 display: flex;
840 flex-direction: column;
d6af8146 841 height: $avatar-height;
d6af8146
RK
842 justify-content: center;
843 }
844 }
845}
7a03209d 846
cdeddff1
C
847// applies ratio (default to 16:9) to a child element (using $selector) only using
848// an immediate's parent size. This allows to set a ratio without explicit
e66883b3 849// dimensions, as width/height cannot be computed from each other.
8cbc40b2 850@mixin block-ratio ($selector: 'div', $inverted-ratio: math.div(9, 16)) {
cdeddff1
C
851 $padding-percent: percentage($inverted-ratio);
852
e66883b3
RK
853 position: relative;
854 height: 0;
855 width: 100%;
cdeddff1 856 padding-top: $padding-percent;
e66883b3
RK
857
858 #{$selector} {
859 position: absolute;
860 width: 100%;
861 height: 100%;
862 top: 0;
37a44fc9 863
e66883b3
RK
864 @content;
865 }
866}
ed5bb517
K
867
868@mixin sub-menu-h1 {
869 ::ng-deep h1 {
870 font-size: 1.3rem;
871 border-bottom: 2px solid $grey-background-color;
872 padding-bottom: 15px;
873 margin-bottom: $sub-menu-margin-bottom;
874
cd262619 875 > span > my-global-icon,
205e4f56 876 > my-global-icon {
27bc9586 877 @include margin-right(10px);
ed5bb517
K
878 width: 24px;
879 height: 24px;
cd262619 880 vertical-align: top;
ed5bb517
K
881 }
882
4c8749cb 883 .pt-badge {
27bc9586 884 @include margin-left(7px);
4c8749cb 885
cd262619 886 vertical-align: top;
ed5bb517
K
887 }
888 }
889}
4572c3d0
C
890
891@mixin play-icon ($width, $height) {
892 width: 0;
893 height: 0;
894
895 position: absolute;
896 left: 50%;
897 top: 50%;
898 transform: translate(-50%, -50%) scale(0.5);
899
8cbc40b2
C
900 border-top: #{math.div($height, 2)} solid transparent;
901 border-bottom: #{math.div($height, 2)} solid transparent;
4572c3d0
C
902
903 border-left: $width solid rgba(255, 255, 255, 0.95);
904}
0f7407d9
C
905
906@mixin on-small-main-col () {
907 :host-context(.main-col:not(.expanded)) {
908 @media screen and (max-width: $small-view + $menu-width) {
909 @content;
910 }
911 }
912
913 :host-context(.main-col.expanded) {
914 @media screen and (max-width: $small-view) {
915 @content;
916 }
917 }
918}
919
920@mixin on-mobile-main-col () {
921 :host-context(.main-col:not(.expanded)) {
922 @media screen and (max-width: $mobile-view + $menu-width) {
923 @content;
924 }
925 }
926
927 :host-context(.main-col.expanded) {
928 @media screen and (max-width: $mobile-view) {
929 @content;
930 }
931 }
932}
27bc9586
C
933
934@mixin margin ($block-start, $inline-end, $block-end, $inline-start) {
935 @include margin-left($inline-start);
936 @include margin-right($inline-end);
937
938 margin-top: $block-start;
939 margin-bottom: $block-end;
940}
941
942@mixin padding ($block-start, $inline-end, $block-end, $inline-start) {
943 @include padding-left($inline-start);
944 @include padding-right($inline-end);
945
946 padding-top: $block-start;
947 padding-bottom: $block-end;
948}
949
950@mixin margin-left ($value) {
951 @supports (margin-inline-start: $value) {
952 margin-inline-start: $value;
953 }
954
955 @supports not (margin-inline-start: $value) {
956 margin-left: $value;
957 }
958}
959
960@mixin margin-right ($value) {
961 @supports (margin-inline-end: $value) {
962 margin-inline-end: $value;
963 }
964
965 @supports not (margin-inline-end: $value) {
966 margin-right: $value;
967 }
968}
969
970@mixin padding-left ($value) {
971 @supports (padding-inline-start: $value) {
972 padding-inline-start: $value;
973 }
974
975 @supports not (padding-inline-start: $value) {
976 padding-left: $value;
977 }
978}
979
980@mixin padding-right ($value) {
981 @supports (padding-inline-end: $value) {
982 padding-inline-end: $value;
983 }
984
985 @supports not (padding-inline-end: $value) {
986 padding-right: $value;
987 }
988}