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