]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
inject lang in document to match current locale
[github/Chocobozzz/PeerTube.git] / client / src / sass / include / _mixins.scss
CommitLineData
63c4db6d
C
1@import '_variables';
2
26c6ee80 3@mixin disable-default-a-behaviour {
cadb46d8 4 &:hover, &:focus, &:active {
26c6ee80
C
5 text-decoration: none !important;
6 outline: none !important;
7 }
8}
c30745f3 9
3ec8dc09 10@mixin disable-outline {
e78980eb
RK
11 &:focus:not(.focus-visible) {
12 outline: none;
13 }
3ec8dc09
C
14}
15
ef80c66c
C
16@mixin ellipsis {
17 white-space: nowrap;
18 overflow: hidden;
19 text-overflow: ellipsis;
20}
0c9945d9
C
21
22@mixin ellipsis-multiline($font-size: 16px, $number-of-lines: 2) {
769ac6c1
RK
23 display: block;
24 /* Fallback for non-webkit */
25 display: -webkit-box;
0c9945d9 26 max-height: $font-size * $number-of-lines;
769ac6c1
RK
27 /* Fallback for non-webkit */
28 font-size: $font-size;
8fc02e47 29 line-height: $font-size;
769ac6c1
RK
30 overflow: hidden;
31 text-overflow: ellipsis;
32}
33
34@mixin prefix($property, $parameters...) {
35 @each $prefix in -webkit-, -moz-, -ms-, -o-, "" {
36 #{$prefix}#{$property}: $parameters;
37 }
38}
39
7a14004b 40@mixin peertube-word-wrap {
fc641ded 41 word-break: break-word;
7a14004b
C
42 word-wrap: break-word;
43 overflow-wrap: break-word;
44 -webkit-hyphens: auto;
45 -ms-hyphens: auto;
46 -moz-hyphens: auto;
47 hyphens: auto;
7a14004b
C
48}
49
457bb213 50@mixin apply-svg-color ($color) {
03652b31 51 ::ng-deep svg {
a55052c9
C
52 path[fill="#000000"],
53 g[fill="#000000"],
54 rect[fill="#000000"],
55 circle[fill="#000000"],
56 polygon[fill="#000000"] {
457bb213
C
57 fill: $color;
58 }
59
a55052c9
C
60 path[stroke="#000000"],
61 g[stroke="#000000"],
62 rect[stroke="#000000"],
63 circle[stroke="#000000"],
64 polygon[stroke="#000000"] {
457bb213
C
65 stroke: $color;
66 }
a55052c9
C
67
68 stop[stop-color="#000000"] {
69 stop-color: $color;
70 }
457bb213
C
71 }
72}
73
d3217560
RK
74@mixin fill-svg-color ($color) {
75 ::ng-deep svg {
76 path {
77 fill: $color;
78 }
79 }
80}
81
a6d5ff76
RK
82@mixin button-focus($color) {
83 &:focus,
e40afb5b 84 &.focus-visible {
6a4c30de 85 box-shadow: #{$focus-box-shadow-form} $color;
e40afb5b
RK
86 }
87}
88
c30745f3
C
89@mixin peertube-input-text($width) {
90 display: inline-block;
91 height: $button-height;
92 width: $width;
3bf07dd8 93 color: var(--inputForegroundColor);
f33dc6ab 94 background-color: var(--inputBackgroundColor);
c30745f3
C
95 border: 1px solid #C6C6C6;
96 border-radius: 3px;
97 padding-left: 15px;
15ca2e87 98 padding-right: 15px;
17bb716b 99 font-size: 15px;
9a0fc840
RK
100
101 &::placeholder {
102 color: var(--inputPlaceholderColor);
103 }
2860e62e
C
104
105 @media screen and (max-width: $width) {
106 width: 100%;
107 }
8a19bee1 108}
c30745f3 109
8a19bee1
C
110@mixin peertube-input-group($width) {
111 width: $width;
2a53942d 112 min-height: $button-height;
8a19bee1
C
113 padding-top: 0;
114 padding-bottom: 0;
115
116 .input-group-text{
117 font-size: 14px;
9a0fc840 118 color: gray;
c30745f3
C
119 }
120}
121
5f0805d3
C
122@mixin peertube-textarea ($width, $height) {
123 @include peertube-input-text($width);
124
3bf07dd8
C
125 color: var(--textareaForegroundColor);
126 background-color: var(--textareaBackgroundColor);
5f0805d3
C
127 height: $height;
128 padding: 5px 15px;
129 font-size: 15px;
130}
131
7b272fd7 132@mixin orange-button {
a6d5ff76 133 @include button-focus(var(--mainColorLightest));
e40afb5b 134
15a7387d
C
135 &, &:active, &:focus {
136 color: #fff;
9a0fc840 137 background-color: var(--mainColor);
15a7387d 138 }
7b272fd7 139
15a7387d 140 &:hover {
0727cab0 141 color: #fff;
9a0fc840 142 background-color: var(--mainHoverColor);
7b272fd7 143 }
4cc66133
C
144
145 &[disabled], &.disabled {
146 cursor: default;
cadb46d8
C
147 color: #fff;
148 background-color: #C6C6C6;
4cc66133 149 }
457bb213
C
150
151 my-global-icon {
152 @include apply-svg-color(#fff)
153 }
7b272fd7
C
154}
155
54e78847 156@mixin tertiary-button {
a6d5ff76
RK
157 @include button-focus($grey-button-outline-color);
158
c123027f 159 color: var(--greyForegroundColor);
54e78847
RK
160 background-color: transparent;
161
162 &[disabled], &.disabled {
163 cursor: default;
164 }
165
166 my-global-icon {
167 @include apply-svg-color(transparent)
168 }
169}
170
7b272fd7 171@mixin grey-button {
a6d5ff76
RK
172 @include button-focus($grey-button-outline-color);
173
15a7387d 174 &, &:active, &:focus {
457bb213 175 background-color: $grey-background-color;
c123027f 176 color: var(--greyForegroundColor);
15a7387d 177 }
7b272fd7 178
4cc66133 179 &:hover, &:active, &:focus, &[disabled], &.disabled {
c123027f 180 color: var(--greyForegroundColor);
457bb213 181 background-color: $grey-background-hover-color;
7b272fd7 182 }
4cc66133
C
183
184 &[disabled], &.disabled {
185 cursor: default;
186 }
457bb213
C
187
188 my-global-icon {
c123027f 189 @include apply-svg-color(var(--greyForegroundColor))
457bb213 190 }
7b272fd7
C
191}
192
c30745f3
C
193@mixin peertube-button {
194 border: none;
c30745f3
C
195 font-weight: $font-semibold;
196 font-size: 15px;
197 height: $button-height;
198 line-height: $button-height;
199 border-radius: 3px;
200 text-align: center;
c30745f3
C
201 padding: 0 17px 0 13px;
202 cursor: pointer;
203}
204
205@mixin peertube-button-link {
206 display: inline-block;
207
c30745f3 208 @include disable-default-a-behaviour;
ce0e281d 209 @include peertube-button;
c30745f3 210}
2295ce6c 211
aa0f1963
RK
212@mixin peertube-button-outline {
213 display: inline-block;
214
215 @include disable-default-a-behaviour;
216 @include peertube-button;
217
218 border: 1px solid;
219}
220
457bb213
C
221@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) {
222 my-global-icon {
223 position: relative;
224 width: $width;
225 margin-right: $margin-right;
226 top: $top;
227 }
228}
229
c5911fd3
C
230@mixin peertube-button-file ($width) {
231 position: relative;
232 overflow: hidden;
233 display: inline-block;
234 width: $width;
e61151b0 235 min-height: 30px;
c5911fd3
C
236
237 @include peertube-button;
238 @include orange-button;
239
240 input[type=file] {
241 position: absolute;
242 top: 0;
243 right: 0;
e61151b0
RK
244 width: 100%;
245 height: 100%;
c5911fd3
C
246 font-size: 100px;
247 text-align: right;
248 filter: alpha(opacity=0);
249 opacity: 0;
250 outline: none;
251 background: white;
252 cursor: inherit;
253 display: block;
254 }
255}
256
0727cab0
C
257@mixin icon ($size) {
258 display: inline-block;
259 background-repeat: no-repeat;
260 background-size: contain;
261 width: $size;
262 height: $size;
263 vertical-align: middle;
264 cursor: pointer;
265}
4cc66133 266
3caf77d3
C
267@mixin select-arrow-down {
268 top: 50%;
269 right: calc(0% + 15px);
270 content: " ";
271 height: 0;
272 width: 0;
273 position: absolute;
274 pointer-events: none;
275 border: 5px solid rgba(0, 0, 0, 0);
276 border-top-color: #000;
277 margin-top: -2px;
278 z-index: 100;
279}
280
15a7387d
C
281@mixin peertube-select-container ($width) {
282 padding: 0;
283 margin: 0;
4cc66133
C
284 width: $width;
285 border-radius: 3px;
3bf07dd8 286 color: var(--inputForegroundColor);
14aa8556 287 background: var(--inputBackgroundColor);
15a7387d 288 position: relative;
5f0805d3 289 font-size: 15px;
15a7387d 290
2f4c784a
C
291 &.disabled {
292 background-color: #E5E5E5;
293
294 select {
295 cursor: default;
296 }
297 }
298
2c3abc4f
C
299 @media screen and (max-width: $width) {
300 width: 100%;
301 }
302
15a7387d 303 &:after {
3caf77d3 304 @include select-arrow-down;
15a7387d
C
305 }
306
307 select {
108af661 308 padding: 0 35px 0 12px;
15a7387d
C
309 width: calc(100% + 2px);
310 position: relative;
311 left: 1px;
a6d5ff76 312 border: 1px solid #C6C6C6;
15a7387d
C
313 background: transparent none;
314 appearance: none;
315 cursor: pointer;
316 height: $button-height;
108af661 317 text-overflow: ellipsis;
8b183196 318 color: var(--mainForegroundColor);
15a7387d
C
319
320 &:focus {
321 outline: none;
322 }
323
324 &:-moz-focusring {
325 color: transparent;
326 text-shadow: 0 0 0 #000;
327 }
aa879092
C
328
329 option {
330 color: #000;
331 }
15a7387d
C
332 }
333}
334
5f0805d3
C
335// Thanks: https://codepen.io/triss90/pen/XNEdRe/
336@mixin peertube-radio-container {
337 input[type="radio"] {
338 display: none;
339
340 & + label {
341 font-weight: $font-regular;
342 cursor: pointer;
343
344 &:before {
345 position: relative;
346 top: -2px;
347 content: '';
348 background: #fff;
349 border-radius: 100%;
350 border: 1px solid #000;
351 display: inline-block;
352 width: 15px;
353 height: 15px;
354 vertical-align: middle;
355 cursor: pointer;
356 text-align: center;
357 margin-right: 10px;
358 }
359 }
360
361 &:checked + label:before {
362 background-color: #000;
363 box-shadow: inset 0 0 0 4px #fff;
364 }
365
366 &:focus + label:before {
367 outline: none;
368 border-color: #000;
369 }
370 }
371}
372
a0d69908 373@mixin peertube-checkbox ($border-width) {
1d5342ab 374 opacity: 0;
776ca9b1 375 position: absolute;
1d5342ab
C
376
377 &:focus + span {
6a4c30de 378 box-shadow: #{$focus-box-shadow-form} var(--mainColorLightest);
1d5342ab 379 }
a0d69908 380
0f7fedc3 381 & + span {
a0d69908
C
382 position: relative;
383 width: 18px;
bc20aaed 384 min-width: 18px;
a0d69908 385 height: 18px;
5fd3e00a 386 border: $border-width solid #C6C6C6;
a0d69908
C
387 border-radius: 3px;
388 vertical-align: middle;
389 cursor: pointer;
390
391 &:after {
392 content: '';
393 position: absolute;
394 top: calc(2px - #{$border-width});
395 left: 5px;
396 width: 5px;
397 height: 12px;
398 opacity: 0;
399 transform: rotate(45deg) scale(0);
18c97728
C
400 border-right: 2px solid $bg-color;
401 border-bottom: 2px solid $bg-color;
a0d69908
C
402 }
403 }
404
0f7fedc3 405 &:checked + span {
a0d69908 406 border-color: transparent;
680b5496 407 background: var(--mainColor);
a0d69908
C
408 animation: jelly 0.6s ease;
409
410 &:after {
411 opacity: 1;
412 transform: rotate(45deg) scale(1);
413 }
414 }
415
0f7fedc3 416 & + span + span {
a0d69908
C
417 font-size: 15px;
418 font-weight: $font-regular;
419 margin-left: 5px;
420 cursor: pointer;
6693df9d 421 display: inline;
a0d69908 422 }
bbe0f064 423
0f7fedc3
C
424 &[disabled] + span,
425 &[disabled] + span + span{
bbe0f064
C
426 opacity: 0.5;
427 cursor: default;
428 }
a0d69908
C
429}
430
4e8c8728
C
431
432@mixin avatar ($size) {
433 object-fit: cover;
a4f99a76 434 border-radius: 50%;
4e8c8728
C
435 width: $size;
436 height: $size;
6051946e 437 min-width: $size;
fc641ded 438 min-height: $size;
4e8c8728 439}
c6352f2c
C
440
441@mixin chevron ($size, $border-width) {
442 border-style: solid;
443 border-width: $border-width $border-width 0 0;
444 content: '';
445 display: inline-block;
446 transform: rotate(-45deg);
447 height: $size;
448 width: $size;
449}
450
451@mixin chevron-right ($size, $border-width) {
452 @include chevron($size, $border-width);
453
454 left: 0;
455 transform: rotate(45deg);
456}
457
458@mixin chevron-left ($size, $border-width) {
459 @include chevron($size, $border-width);
460
461 left: 0.25em;
462 transform: rotate(-135deg);
463}
0626e7af
C
464
465@mixin in-content-small-title {
466 text-transform: uppercase;
9a0fc840 467 color: var(--mainColor);
0626e7af
C
468 font-weight: $font-bold;
469 font-size: 13px;
170726f5
C
470}
471
482fa503
RK
472@mixin settings-big-title {
473 text-transform: uppercase;
474 color: var(--mainColor);
475 font-weight: $font-bold;
476 font-size: 110%;
477 margin-bottom: 10px;
478}
479
22a16e36
C
480@mixin actor-owner {
481 @include disable-default-a-behaviour;
482
22a16e36
C
483 font-size: 13px;
484 margin-top: 4px;
9a0fc840 485 color: var(--mainForegroundColor);
22a16e36
C
486
487 span:hover {
488 opacity: 0.8;
489 }
490
491 img {
492 @include avatar(18px);
493
494 margin-left: 7px;
495 position: relative;
496 top: -2px;
497 }
498}
499
170726f5 500@mixin sub-menu-with-actor {
aa0f1963 501 height: max-content;
170726f5
C
502 display: flex;
503 flex-direction: column;
41d71344 504 align-items: flex-start;
170726f5
C
505
506 .actor {
507 display: flex;
508 margin-top: 20px;
509 margin-bottom: 20px;
510
511 img {
512 @include avatar(80px);
513
514 margin-right: 20px;
515 }
516
517 .actor-info {
518 display: flex;
519 flex-direction: column;
520 justify-content: center;
521
7de6afdf
C
522 .actor-names {
523 display: flex;
524 align-items: center;
9b8a7aa8 525 flex-wrap: wrap;
7de6afdf
C
526
527 .actor-display-name {
528 font-size: 23px;
529 font-weight: $font-bold;
9b8a7aa8 530 margin-right: 7px;
7de6afdf
C
531 }
532
533 .actor-name {
7de6afdf
C
534 position: relative;
535 top: 3px;
536 font-size: 14px;
22a16e36 537 color: $grey-actor-name;
7de6afdf 538 }
170726f5
C
539 }
540
9b8a7aa8
RK
541 .actor-lower {
542 grid-area: lower;
543 }
544
170726f5
C
545 .actor-followers {
546 font-size: 15px;
547 }
a4f99a76
C
548
549 .actor-owner {
22a16e36 550 @include actor-owner;
a4f99a76 551 }
170726f5
C
552 }
553 }
554
555 .links {
556 margin-top: 0;
de702865 557 margin-bottom: 15px;
170726f5
C
558
559 a {
560 margin-top: 0;
561 margin-bottom: 0;
b061c8ed
RK
562 text-transform: uppercase;
563 font-weight: 600;
9b8a7aa8
RK
564 font-size: 110%;
565
566 @media screen and (max-width: $mobile-view) {
567 font-size: 130%;
568 }
170726f5
C
569 }
570 }
08c1efbe
C
571}
572
457bb213 573@mixin create-button {
08c1efbe
C
574 @include peertube-button-link;
575 @include orange-button;
457bb213 576 @include button-with-icon(20px, 5px, -1px);
a4f99a76 577}
22a16e36
C
578
579@mixin row-blocks {
580 display: flex;
581 min-height: 130px;
582 padding-bottom: 20px;
583 margin-bottom: 20px;
584 border-bottom: 1px solid #C6C6C6;
585
586 @media screen and (max-width: 800px) {
587 flex-direction: column;
588 height: auto;
22a16e36
C
589 align-items: center;
590 }
6aff854c 591}
c5a1ae50
C
592
593@mixin dropdown-with-icon-item {
bc584963 594 padding: 6px 15px;
c5a1ae50
C
595
596 my-global-icon {
bc584963
RK
597 width: 22px;
598 opacity: .7;
c5a1ae50
C
599
600 margin-right: 10px;
601 position: relative;
602 top: -2px;
603 }
604}
e61151b0
RK
605
606@mixin progressbar {
607 background-color: $grey-background-color;
608 display: flex;
609 height: 1rem;
610 overflow: hidden;
611 font-size: 0.75rem;
612 border-radius: 0.25rem;
613
614 .progress-bar {
615 color: var(--mainBackgroundColor);
616 background-color: var(--mainColor);
617 display: flex;
618 flex-direction: column;
619 justify-content: center;
620 text-align: center;
621 white-space: nowrap;
622 transition: width 0.6s ease;
623
624 &.secondary {
625 background-color: var(--secondaryColor);
626 }
627 }
628}
76314386
RK
629
630@mixin breadcrumb {
631 display: flex;
632 flex-wrap: wrap;
633 padding: 0.75rem 1rem;
634 margin-bottom: 1rem;
635 list-style: none;
636 background-color: var(--submenuColor);
637 border-radius: 0.25rem;
638
639 .breadcrumb-item {
640 display: flex;
641
642 a {
643 color: var(--mainColor);
644 }
645
646 & + .breadcrumb-item {
647 padding-left: 0.5rem;
648 &::before {
649 display: inline-block;
650 padding-right: 0.5rem;
651 color: #6c757d;
652 content: "/";
653 }
654 }
655
656 &.active {
657 color: #6c757d;
658 }
659 }
660}
661
662@mixin dashboard {
663 display: flex;
664 flex-wrap: wrap;
665 margin: 0 -5px;
666
667 & > div {
668 box-sizing: border-box;
669 flex: 0 0 percentage(1/3);
670 padding: 0 5px;
671 margin-bottom: 10px;
672
673 & > a {
d1261d9a
RK
674 @include disable-default-a-behaviour;
675
76314386
RK
676 text-decoration: none;
677 color: inherit;
678 display: block;
679 font-size: 18px;
680
681 &:active,
682 &:focus,
683 &:hover {
684 opacity: .8;
685 }
686 }
687
688 & > a,
689 & > div {
690 padding: 20px;
691 background: var(--submenuColor);
692 border-radius: 4px;
693 box-sizing: border-box;
694 height: 100%;
695 }
696 }
697
698 .dashboard-num, .dashboard-text {
699 text-align: center;
700 font-size: 130%;
701 line-height: 21px;
702 color: var(--mainForegroundColor);
703 line-height: 30px;
704 margin-bottom: 20px;
705 }
706
707 .dashboard-label {
708 font-size: 90%;
709 color: var(--inputPlaceholderColor);
710 text-align: center;
711 }
712}
a6d5ff76
RK
713
714@mixin ng2-tags {
715 ::ng-deep {
716 .ng2-tag-input {
717 border: none !important;
718 }
719
720 .ng2-tags-container {
721 display: flex;
722 align-items: center;
723 border: 1px solid #C6C6C6;
724 border-radius: 3px;
725 padding: 5px !important;
726 height: max-content;
727
728 &:focus-within {
6a4c30de 729 box-shadow: #{$focus-box-shadow-form} var(--mainColorLightest);
a6d5ff76
RK
730 }
731 }
732
733 tag-input-form {
734 input {
735 height: 30px !important;
736 font-size: 12px !important;
737
738 background-color: var(--mainBackgroundColor) !important;
739 color: var(--mainForegroundColor) !important;
740 }
741 }
742
743 tag {
744 background-color: $grey-background-color !important;
745 color: #000 !important;
746 border-radius: 3px !important;
747 font-size: 12px !important;
748 height: 30px !important;
749 line-height: 30px !important;
750 margin: 0 5px 0 0 !important;
751 cursor: default !important;
752 padding: 0 8px 0 10px !important;
753
754 div {
755 height: 100% !important;
756 }
757 }
758
759 delete-icon {
760 cursor: pointer !important;
761 height: auto !important;
762 vertical-align: middle !important;
763 padding-left: 6px !important;
764
765 svg {
766 position: relative;
767 top: -1px;
768 height: auto !important;
769 vertical-align: middle !important;
770
771 path {
c123027f 772 fill: var(--greyForegroundColor) !important;
a6d5ff76
RK
773 }
774 }
775
776 &:hover {
777 transform: none !important;
778 }
779 }
780 }
781}
b515c98c
RK
782
783@mixin divider($color: var(--submenuColor), $background: var(--mainBackgroundColor)) {
784 width: 95%;
785 border-top: .05rem solid $color;
786 height: .05rem;
787 text-align: center;
788 display: block;
789 position: relative;
790
791 &[data-content] {
792 margin: .8rem 0;
793
794 &::after {
795 background: $background;
796 color: $color;
797 content: attr(data-content);
798 display: inline-block;
799 font-size: .7rem;
800 padding: 0 .4rem;
801 transform: translateY(-.65rem);
802 }
803 }
804}
d6af8146
RK
805
806@mixin chip {
807 $avatar-height: 1.2rem;
808
809 align-items: center;
810 border-radius: 5rem;
811 display: inline-flex;
812 font-size: 90%;
813 color: var(--mainForegroundColor);
814 height: $avatar-height;
06827932 815 line-height: 1rem;
d6af8146
RK
816 margin: .1rem;
817 max-width: 320px;
818 overflow: hidden;
819 padding: .2rem .4rem;
820 text-decoration: none;
821 text-overflow: ellipsis;
822 vertical-align: middle;
823 white-space: nowrap;
824
825 .avatar {
826 margin-left: -.4rem;
827 margin-right: .2rem;
828 height: $avatar-height;
829 width: $avatar-height;
830
831 border-radius: 50%;
832 display: inline-block;
833 line-height: 1.25;
834 position: relative;
835 vertical-align: middle;
836 }
837
838 &.two-lines {
36f772fd 839 $avatar-height: 2rem;
d6af8146
RK
840
841 height: $avatar-height;
842
843 .avatar {
844 height: $avatar-height;
845 width: $avatar-height;
846 }
847
848 div {
849 display: flex;
850 flex-direction: column;
d6af8146
RK
851 height: $avatar-height;
852 margin-left: .1rem;
853 margin-right: .1rem;
854 justify-content: center;
855 }
856 }
857}
7a03209d 858
d3840613
RK
859@mixin empty-state {
860 min-height: 40vh;
861 max-height: 500px;
862
863 display: flex;
864 justify-content: center;
865 align-items: center;
866}
867
7a03209d
K
868@mixin admin-sub-header-responsive ($horizontal-margins) {
869 flex-direction: column;
870
871 .form-sub-title {
872 margin-right: 0px !important;
873 margin-bottom: 10px;
874 text-align: center;
875 }
876
877 .admin-sub-nav {
878 display: block;
879 overflow-x: auto;
880 white-space: nowrap;
881 height: 50px;
882 padding: 10px 0;
883 width: calc(100vw - #{$horizontal-margins*2});
884
885 a {
886 margin-left: 5px;
887 }
888 }
889}