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