]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
Merge branch 'next' 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
5f0805d3
C
423// Thanks: https://codepen.io/triss90/pen/XNEdRe/
424@mixin peertube-radio-container {
931d3430 425 input[type=radio] {
5f0805d3
C
426 display: none;
427
931d3430 428 + label {
5f0805d3
C
429 font-weight: $font-regular;
430 cursor: pointer;
431
931d3430 432 &::before {
27bc9586
C
433 @include margin-right(10px);
434
5f0805d3
C
435 position: relative;
436 top: -2px;
437 content: '';
438 background: #fff;
439 border-radius: 100%;
440 border: 1px solid #000;
441 display: inline-block;
442 width: 15px;
443 height: 15px;
444 vertical-align: middle;
445 cursor: pointer;
446 text-align: center;
5f0805d3
C
447 }
448 }
449
931d3430 450 &:checked + label::before {
5f0805d3
C
451 background-color: #000;
452 box-shadow: inset 0 0 0 4px #fff;
453 }
454
931d3430 455 &:focus + label::before {
5f0805d3
C
456 outline: none;
457 border-color: #000;
458 }
459 }
460}
461
a0d69908 462@mixin peertube-checkbox ($border-width) {
1d5342ab 463 opacity: 0;
776ca9b1 464 position: absolute;
1d5342ab
C
465
466 &:focus + span {
e66883b3 467 box-shadow: #{$focus-box-shadow-form} pvar(--mainColorLightest);
1d5342ab 468 }
a0d69908 469
931d3430 470 + span {
a0d69908
C
471 position: relative;
472 width: 18px;
bc20aaed 473 min-width: 18px;
a0d69908 474 height: 18px;
5fd3e00a 475 border: $border-width solid #C6C6C6;
a0d69908
C
476 border-radius: 3px;
477 vertical-align: middle;
478 cursor: pointer;
479
931d3430 480 &::after {
a0d69908
C
481 content: '';
482 position: absolute;
483 top: calc(2px - #{$border-width});
484 left: 5px;
485 width: 5px;
486 height: 12px;
487 opacity: 0;
488 transform: rotate(45deg) scale(0);
18c97728
C
489 border-right: 2px solid $bg-color;
490 border-bottom: 2px solid $bg-color;
a0d69908
C
491 }
492 }
493
0f7fedc3 494 &:checked + span {
a0d69908 495 border-color: transparent;
e66883b3 496 background: pvar(--mainColor);
a0d69908
C
497 animation: jelly 0.6s ease;
498
931d3430 499 &::after {
a0d69908
C
500 opacity: 1;
501 transform: rotate(45deg) scale(1);
502 }
503 }
504
931d3430 505 + span + span {
27bc9586
C
506 @include margin-left(5px);
507
a0d69908
C
508 font-size: 15px;
509 font-weight: $font-regular;
a0d69908 510 cursor: pointer;
6693df9d 511 display: inline;
a0d69908 512 }
bbe0f064 513
0f7fedc3 514 &[disabled] + span,
931d3430 515 &[disabled] + span + span {
bbe0f064
C
516 opacity: 0.5;
517 cursor: default;
518 }
a0d69908
C
519}
520
654a188f
RK
521@mixin table-badge {
522 border-radius: 2px;
523 padding: 1/4em 1/2em;
524 text-transform: uppercase;
525 font-weight: $font-bold;
526 font-size: 12px;
527 letter-spacing: 1/3px;
528
529 &.badge-banned,
530 &.badge-red {
531 background-color: #ffcdd2;
532 color: #c63737;
533 }
534
535 &.badge-banned {
536 text-decoration: line-through;
537 }
538
539 &.badge-yellow {
540 background-color: #feedaf;
541 color: #8a5340;
542 }
543
544 &.badge-brown {
545 background-color: #ffd8b2;
546 color: #805b36;
547 }
548
549 &.badge-green {
550 background-color: #c8e6c9;
551 color: #256029;
552 }
553
554 &.badge-blue {
555 background-color: #b3e5fc;
556 color: #23547b;
557 }
558
559 &.badge-purple {
560 background-color: #eccfff;
561 color: #694382;
562 }
563}
4e8c8728 564
746018f6
C
565@mixin actor-avatar-size ($size) {
566 display: inline-block;
60c35932
C
567 width: $size;
568 height: $size;
569 min-width: $size;
570 min-height: $size;
571}
572
61cbafc1
C
573@mixin actor-counters ($separator-margin: 10px) {
574 color: pvar(--greyForegroundColor);
575 font-size: 16px;
576 display: flex;
577 align-items: center;
578
579 > *:not(:last-child)::after {
580 content: '•';
581 margin: 0 $separator-margin;
582 color: pvar(--mainColor);
583 }
584}
585
c6352f2c
C
586@mixin chevron ($size, $border-width) {
587 border-style: solid;
588 border-width: $border-width $border-width 0 0;
589 content: '';
590 display: inline-block;
591 transform: rotate(-45deg);
592 height: $size;
593 width: $size;
594}
595
596@mixin chevron-right ($size, $border-width) {
597 @include chevron($size, $border-width);
598
599 left: 0;
600 transform: rotate(45deg);
601}
602
603@mixin chevron-left ($size, $border-width) {
604 @include chevron($size, $border-width);
605
606 left: 0.25em;
607 transform: rotate(-135deg);
608}
0626e7af
C
609
610@mixin in-content-small-title {
611 text-transform: uppercase;
e66883b3 612 color: pvar(--mainColor);
0626e7af
C
613 font-weight: $font-bold;
614 font-size: 13px;
170726f5
C
615}
616
482fa503
RK
617@mixin settings-big-title {
618 text-transform: uppercase;
e66883b3 619 color: pvar(--mainColor);
482fa503
RK
620 font-weight: $font-bold;
621 font-size: 110%;
622 margin-bottom: 10px;
623}
624
457bb213 625@mixin create-button {
08c1efbe
C
626 @include peertube-button-link;
627 @include orange-button;
457bb213 628 @include button-with-icon(20px, 5px, -1px);
a4f99a76 629}
22a16e36 630
0f7407d9 631@mixin row-blocks ($column-responsive: true) {
22a16e36
C
632 display: flex;
633 min-height: 130px;
634 padding-bottom: 20px;
635 margin-bottom: 20px;
636 border-bottom: 1px solid #C6C6C6;
637
0f7407d9
C
638 @media screen and (max-width: $small-view) {
639 @if $column-responsive {
640 flex-direction: column;
641 height: auto;
642 align-items: center;
643 } @else {
644 min-height: initial;
645 padding-bottom: 10px;
646 margin-bottom: 10px;
647 }
22a16e36 648 }
6aff854c 649}
c5a1ae50
C
650
651@mixin dropdown-with-icon-item {
bc584963 652 padding: 6px 15px;
c5a1ae50
C
653
654 my-global-icon {
27bc9586
C
655 @include margin-right(10px);
656
bc584963
RK
657 width: 22px;
658 opacity: .7;
c5a1ae50
C
659 position: relative;
660 top: -2px;
661 }
662}
e61151b0 663
66927c05 664@mixin progressbar($small: false) {
e61151b0
RK
665 background-color: $grey-background-color;
666 display: flex;
667 height: 1rem;
668 overflow: hidden;
669 font-size: 0.75rem;
670 border-radius: 0.25rem;
bc99dfe5
RK
671 position: relative;
672
673 span {
674 position: absolute;
4f5d0459 675 color: $grey-foreground-color;
66927c05
RK
676 @if $small {
677 top: -1px;
678 }
bc99dfe5
RK
679
680 &:nth-of-type(1) {
681 left: .2rem;
682 }
683 &:nth-of-type(2) {
684 right: .2rem;
685 }
686 }
e61151b0
RK
687
688 .progress-bar {
e66883b3
RK
689 color: pvar(--mainBackgroundColor);
690 background-color: pvar(--mainColor);
e61151b0
RK
691 display: flex;
692 flex-direction: column;
693 justify-content: center;
694 text-align: center;
695 white-space: nowrap;
696 transition: width 0.6s ease;
697
698 &.secondary {
e66883b3 699 background-color: pvar(--secondaryColor);
e61151b0 700 }
d4132d3f
RK
701
702 &.red {
703 background-color: lighten($color: #c54130, $amount: 10);
704 }
e61151b0
RK
705 }
706}
76314386
RK
707
708@mixin breadcrumb {
709 display: flex;
710 flex-wrap: wrap;
711 padding: 0.75rem 1rem;
712 margin-bottom: 1rem;
713 list-style: none;
218f730c 714 background-color: pvar(--submenuBackgroundColor);
76314386
RK
715 border-radius: 0.25rem;
716
717 .breadcrumb-item {
718 display: flex;
719
720 a {
e66883b3 721 color: pvar(--mainColor);
76314386
RK
722 }
723
931d3430 724 + .breadcrumb-item {
27bc9586
C
725 @include padding-left(0.5rem);
726
76314386 727 &::before {
27bc9586
C
728 @include padding-right(0.5rem);
729
76314386 730 display: inline-block;
76314386 731 color: #6c757d;
931d3430 732 content: '/';
76314386
RK
733 }
734 }
735
736 &.active {
737 color: #6c757d;
738 }
739 }
740}
741
742@mixin dashboard {
743 display: flex;
744 flex-wrap: wrap;
745 margin: 0 -5px;
746
931d3430 747 > div {
76314386 748 box-sizing: border-box;
8cbc40b2 749 flex: 0 0 percentage(math.div(1, 3));
76314386
RK
750 padding: 0 5px;
751 margin-bottom: 10px;
752
931d3430 753 > a {
d1261d9a
RK
754 @include disable-default-a-behaviour;
755
76314386
RK
756 text-decoration: none;
757 color: inherit;
758 display: block;
759 font-size: 18px;
760
761 &:active,
762 &:focus,
763 &:hover {
764 opacity: .8;
765 }
766 }
767
931d3430
C
768 > a,
769 > div {
76314386 770 padding: 20px;
218f730c 771 background: pvar(--submenuBackgroundColor);
76314386
RK
772 border-radius: 4px;
773 box-sizing: border-box;
774 height: 100%;
775 }
776 }
777
931d3430
C
778 .dashboard-num,
779 .dashboard-text {
76314386
RK
780 text-align: center;
781 font-size: 130%;
e66883b3 782 color: pvar(--mainForegroundColor);
76314386
RK
783 line-height: 30px;
784 margin-bottom: 20px;
785 }
786
787 .dashboard-label {
788 font-size: 90%;
e66883b3 789 color: pvar(--inputPlaceholderColor);
76314386
RK
790 text-align: center;
791 }
792}
a6d5ff76 793
218f730c 794@mixin divider($color: pvar(--submenuBackgroundColor), $background: pvar(--mainBackgroundColor)) {
b515c98c
RK
795 width: 95%;
796 border-top: .05rem solid $color;
797 height: .05rem;
798 text-align: center;
799 display: block;
800 position: relative;
801
802 &[data-content] {
803 margin: .8rem 0;
804
805 &::after {
806 background: $background;
807 color: $color;
808 content: attr(data-content);
809 display: inline-block;
810 font-size: .7rem;
811 padding: 0 .4rem;
812 transform: translateY(-.65rem);
813 }
814 }
815}
d6af8146
RK
816
817@mixin chip {
1ebddadd
RK
818 --chip-radius: 5rem;
819 --chip-padding: .2rem .4rem;
d6af8146
RK
820 $avatar-height: 1.2rem;
821
822 align-items: center;
1ebddadd 823 border-radius: var(--chip-radius);
d6af8146
RK
824 display: inline-flex;
825 font-size: 90%;
e66883b3 826 color: pvar(--mainForegroundColor);
d6af8146 827 height: $avatar-height;
06827932 828 line-height: 1rem;
d6af8146
RK
829 margin: .1rem;
830 max-width: 320px;
831 overflow: hidden;
1ebddadd 832 padding: var(--chip-padding);
d6af8146
RK
833 text-decoration: none;
834 text-overflow: ellipsis;
835 vertical-align: middle;
836 white-space: nowrap;
837
1ebddadd
RK
838 &.rectangular {
839 --chip-radius: .2rem;
840 --chip-padding: .2rem .3rem;
841 }
842
f6e98f0a 843 my-actor-avatar {
27bc9586
C
844 @include margin-left(-.4rem);
845 @include margin-right(.2rem);
d6af8146
RK
846 }
847
848 &.two-lines {
36f772fd 849 $avatar-height: 2rem;
d6af8146
RK
850
851 height: $avatar-height;
852
f6e98f0a
C
853 my-actor-avatar {
854 @include actor-avatar-size($avatar-height);
d6af8146
RK
855 }
856
857 div {
27bc9586
C
858 margin: 0 .1rem;
859
d6af8146
RK
860 display: flex;
861 flex-direction: column;
d6af8146 862 height: $avatar-height;
d6af8146
RK
863 justify-content: center;
864 }
865 }
866}
7a03209d 867
cdeddff1
C
868// applies ratio (default to 16:9) to a child element (using $selector) only using
869// an immediate's parent size. This allows to set a ratio without explicit
e66883b3 870// dimensions, as width/height cannot be computed from each other.
8cbc40b2 871@mixin block-ratio ($selector: 'div', $inverted-ratio: math.div(9, 16)) {
cdeddff1
C
872 $padding-percent: percentage($inverted-ratio);
873
e66883b3
RK
874 position: relative;
875 height: 0;
876 width: 100%;
cdeddff1 877 padding-top: $padding-percent;
e66883b3
RK
878
879 #{$selector} {
880 position: absolute;
881 width: 100%;
882 height: 100%;
883 top: 0;
37a44fc9 884
e66883b3
RK
885 @content;
886 }
887}
ed5bb517
K
888
889@mixin sub-menu-h1 {
890 ::ng-deep h1 {
891 font-size: 1.3rem;
892 border-bottom: 2px solid $grey-background-color;
893 padding-bottom: 15px;
894 margin-bottom: $sub-menu-margin-bottom;
895
cd262619 896 > span > my-global-icon,
205e4f56 897 > my-global-icon {
27bc9586 898 @include margin-right(10px);
ed5bb517
K
899 width: 24px;
900 height: 24px;
cd262619 901 vertical-align: top;
ed5bb517
K
902 }
903
904 .badge {
27bc9586 905 @include margin-left(7px);
cd262619 906 vertical-align: top;
ed5bb517
K
907 }
908 }
909}
4572c3d0
C
910
911@mixin play-icon ($width, $height) {
912 width: 0;
913 height: 0;
914
915 position: absolute;
916 left: 50%;
917 top: 50%;
918 transform: translate(-50%, -50%) scale(0.5);
919
8cbc40b2
C
920 border-top: #{math.div($height, 2)} solid transparent;
921 border-bottom: #{math.div($height, 2)} solid transparent;
4572c3d0
C
922
923 border-left: $width solid rgba(255, 255, 255, 0.95);
924}
0f7407d9
C
925
926@mixin on-small-main-col () {
927 :host-context(.main-col:not(.expanded)) {
928 @media screen and (max-width: $small-view + $menu-width) {
929 @content;
930 }
931 }
932
933 :host-context(.main-col.expanded) {
934 @media screen and (max-width: $small-view) {
935 @content;
936 }
937 }
938}
939
940@mixin on-mobile-main-col () {
941 :host-context(.main-col:not(.expanded)) {
942 @media screen and (max-width: $mobile-view + $menu-width) {
943 @content;
944 }
945 }
946
947 :host-context(.main-col.expanded) {
948 @media screen and (max-width: $mobile-view) {
949 @content;
950 }
951 }
952}
27bc9586
C
953
954@mixin margin ($block-start, $inline-end, $block-end, $inline-start) {
955 @include margin-left($inline-start);
956 @include margin-right($inline-end);
957
958 margin-top: $block-start;
959 margin-bottom: $block-end;
960}
961
962@mixin padding ($block-start, $inline-end, $block-end, $inline-start) {
963 @include padding-left($inline-start);
964 @include padding-right($inline-end);
965
966 padding-top: $block-start;
967 padding-bottom: $block-end;
968}
969
970@mixin margin-left ($value) {
971 @supports (margin-inline-start: $value) {
972 margin-inline-start: $value;
973 }
974
975 @supports not (margin-inline-start: $value) {
976 margin-left: $value;
977 }
978}
979
980@mixin margin-right ($value) {
981 @supports (margin-inline-end: $value) {
982 margin-inline-end: $value;
983 }
984
985 @supports not (margin-inline-end: $value) {
986 margin-right: $value;
987 }
988}
989
990@mixin padding-left ($value) {
991 @supports (padding-inline-start: $value) {
992 padding-inline-start: $value;
993 }
994
995 @supports not (padding-inline-start: $value) {
996 padding-left: $value;
997 }
998}
999
1000@mixin padding-right ($value) {
1001 @supports (padding-inline-end: $value) {
1002 padding-inline-end: $value;
1003 }
1004
1005 @supports not (padding-inline-end: $value) {
1006 padding-right: $value;
1007 }
1008}