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