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