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