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