diff options
Diffstat (limited to 'client/src/sass/include/_mixins.scss')
-rw-r--r-- | client/src/sass/include/_mixins.scss | 223 |
1 files changed, 100 insertions, 123 deletions
diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scss index ca11488cb..bf844ac5d 100644 --- a/client/src/sass/include/_mixins.scss +++ b/client/src/sass/include/_mixins.scss | |||
@@ -23,17 +23,28 @@ | |||
23 | display: block; | 23 | display: block; |
24 | /* Fallback for non-webkit */ | 24 | /* Fallback for non-webkit */ |
25 | display: -webkit-box; | 25 | display: -webkit-box; |
26 | max-height: $font-size * $number-of-lines; | 26 | -webkit-line-clamp: $number-of-lines; |
27 | /* Fallback for non-webkit */ | 27 | /* Fallback for non-webkit */ |
28 | font-size: $font-size; | 28 | font-size: $font-size; |
29 | line-height: $font-size; | 29 | line-height: $font-size; |
30 | overflow: hidden; | 30 | overflow: hidden; |
31 | text-overflow: ellipsis; | 31 | text-overflow: ellipsis; |
32 | max-height: $font-size * $number-of-lines; | ||
32 | } | 33 | } |
33 | 34 | ||
34 | @mixin prefix($property, $parameters...) { | 35 | @mixin fade-text ($fade-after, $background-color) { |
35 | @each $prefix in -webkit-, -moz-, -ms-, -o-, "" { | 36 | position: relative; |
36 | #{$prefix}#{$property}: $parameters; | 37 | overflow: hidden; |
38 | |||
39 | &:after { | ||
40 | content: ''; | ||
41 | pointer-events: none; | ||
42 | width: 100%; | ||
43 | height: 100%; | ||
44 | position: absolute; | ||
45 | left: 0; | ||
46 | top: 0; | ||
47 | background: linear-gradient(transparent $fade-after, $background-color); | ||
37 | } | 48 | } |
38 | } | 49 | } |
39 | 50 | ||
@@ -41,9 +52,6 @@ | |||
41 | word-break: break-word; | 52 | word-break: break-word; |
42 | word-wrap: break-word; | 53 | word-wrap: break-word; |
43 | overflow-wrap: break-word; | 54 | overflow-wrap: break-word; |
44 | -webkit-hyphens: auto; | ||
45 | -ms-hyphens: auto; | ||
46 | -moz-hyphens: auto; | ||
47 | hyphens: auto; | 55 | hyphens: auto; |
48 | } | 56 | } |
49 | 57 | ||
@@ -52,28 +60,6 @@ | |||
52 | ::ng-deep .material { | 60 | ::ng-deep .material { |
53 | color: $color; | 61 | color: $color; |
54 | } | 62 | } |
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 | } | 63 | } |
78 | 64 | ||
79 | @mixin fill-svg-color ($color) { | 65 | @mixin fill-svg-color ($color) { |
@@ -163,6 +149,33 @@ | |||
163 | } | 149 | } |
164 | } | 150 | } |
165 | 151 | ||
152 | @mixin orange-button-inverted { | ||
153 | @include button-focus(pvar(--mainColorLightest)); | ||
154 | |||
155 | border: 2px solid pvar(--mainColor); | ||
156 | font-weight: $font-semibold; | ||
157 | |||
158 | &, &:active, &:focus { | ||
159 | color: pvar(--mainColor); | ||
160 | background-color: pvar(--mainBackgroundColor); | ||
161 | } | ||
162 | |||
163 | &:hover { | ||
164 | color: pvar(--mainColor); | ||
165 | background-color: pvar(--mainColorLightest); | ||
166 | } | ||
167 | |||
168 | &[disabled], &.disabled { | ||
169 | cursor: default; | ||
170 | color: pvar(--mainColor); | ||
171 | background-color: #C6C6C6; | ||
172 | } | ||
173 | |||
174 | my-global-icon { | ||
175 | @include apply-svg-color(pvar(--mainColor)) | ||
176 | } | ||
177 | } | ||
178 | |||
166 | @mixin tertiary-button { | 179 | @mixin tertiary-button { |
167 | @include button-focus($grey-button-outline-color); | 180 | @include button-focus($grey-button-outline-color); |
168 | 181 | ||
@@ -534,6 +547,14 @@ | |||
534 | min-height: $size; | 547 | min-height: $size; |
535 | } | 548 | } |
536 | 549 | ||
550 | @mixin channel-avatar ($size) { | ||
551 | width: $size; | ||
552 | height: $size; | ||
553 | min-width: $size; | ||
554 | min-height: $size; | ||
555 | border-radius: 5px; | ||
556 | } | ||
557 | |||
537 | @mixin chevron ($size, $border-width) { | 558 | @mixin chevron ($size, $border-width) { |
538 | border-style: solid; | 559 | border-style: solid; |
539 | border-width: $border-width $border-width 0 0; | 560 | border-width: $border-width $border-width 0 0; |
@@ -593,103 +614,29 @@ | |||
593 | } | 614 | } |
594 | } | 615 | } |
595 | 616 | ||
596 | @mixin sub-menu-with-actor { | ||
597 | position: initial; | ||
598 | z-index: unset; | ||
599 | height: max-content; | ||
600 | display: flex; | ||
601 | flex-direction: column; | ||
602 | align-items: flex-start; | ||
603 | |||
604 | .actor { | ||
605 | display: flex; | ||
606 | margin-top: 20px; | ||
607 | margin-bottom: 20px; | ||
608 | |||
609 | img { | ||
610 | @include avatar(80px); | ||
611 | |||
612 | margin-right: 20px; | ||
613 | } | ||
614 | |||
615 | .actor-info { | ||
616 | display: flex; | ||
617 | flex-direction: column; | ||
618 | justify-content: center; | ||
619 | |||
620 | .actor-names { | ||
621 | display: flex; | ||
622 | align-items: center; | ||
623 | flex-wrap: wrap; | ||
624 | |||
625 | .actor-display-name { | ||
626 | font-size: 23px; | ||
627 | font-weight: $font-bold; | ||
628 | margin-right: 7px; | ||
629 | } | ||
630 | |||
631 | .actor-name { | ||
632 | position: relative; | ||
633 | top: 3px; | ||
634 | font-size: 14px; | ||
635 | color: $grey-actor-name; | ||
636 | } | ||
637 | } | ||
638 | |||
639 | .actor-lower { | ||
640 | grid-area: lower; | ||
641 | } | ||
642 | |||
643 | .actor-followers { | ||
644 | font-size: 15px; | ||
645 | } | ||
646 | |||
647 | .actor-owner { | ||
648 | @include actor-owner; | ||
649 | } | ||
650 | } | ||
651 | } | ||
652 | |||
653 | .links { | ||
654 | margin-top: 0; | ||
655 | margin-bottom: 15px; | ||
656 | |||
657 | a { | ||
658 | margin-top: 0; | ||
659 | margin-bottom: 0; | ||
660 | text-transform: uppercase; | ||
661 | font-weight: 600; | ||
662 | font-size: 110%; | ||
663 | |||
664 | @media screen and (max-width: $mobile-view) { | ||
665 | font-size: 130%; | ||
666 | } | ||
667 | } | ||
668 | |||
669 | list-overflow { | ||
670 | display: inline-block; | ||
671 | width: max-content; | ||
672 | } | ||
673 | } | ||
674 | } | ||
675 | |||
676 | @mixin create-button { | 617 | @mixin create-button { |
677 | @include peertube-button-link; | 618 | @include peertube-button-link; |
678 | @include orange-button; | 619 | @include orange-button; |
679 | @include button-with-icon(20px, 5px, -1px); | 620 | @include button-with-icon(20px, 5px, -1px); |
680 | } | 621 | } |
681 | 622 | ||
682 | @mixin row-blocks { | 623 | @mixin row-blocks ($column-responsive: true) { |
683 | display: flex; | 624 | display: flex; |
684 | min-height: 130px; | 625 | min-height: 130px; |
685 | padding-bottom: 20px; | 626 | padding-bottom: 20px; |
686 | margin-bottom: 20px; | 627 | margin-bottom: 20px; |
687 | border-bottom: 1px solid #C6C6C6; | 628 | border-bottom: 1px solid #C6C6C6; |
688 | 629 | ||
689 | @media screen and (max-width: 800px) { | 630 | @media screen and (max-width: $small-view) { |
690 | flex-direction: column; | 631 | @if $column-responsive { |
691 | height: auto; | 632 | flex-direction: column; |
692 | align-items: center; | 633 | height: auto; |
634 | align-items: center; | ||
635 | } @else { | ||
636 | min-height: initial; | ||
637 | padding-bottom: 10px; | ||
638 | margin-bottom: 10px; | ||
639 | } | ||
693 | } | 640 | } |
694 | } | 641 | } |
695 | 642 | ||
@@ -756,7 +703,7 @@ | |||
756 | padding: 0.75rem 1rem; | 703 | padding: 0.75rem 1rem; |
757 | margin-bottom: 1rem; | 704 | margin-bottom: 1rem; |
758 | list-style: none; | 705 | list-style: none; |
759 | background-color: pvar(--submenuColor); | 706 | background-color: pvar(--submenuBackgroundColor); |
760 | border-radius: 0.25rem; | 707 | border-radius: 0.25rem; |
761 | 708 | ||
762 | .breadcrumb-item { | 709 | .breadcrumb-item { |
@@ -811,7 +758,7 @@ | |||
811 | & > a, | 758 | & > a, |
812 | & > div { | 759 | & > div { |
813 | padding: 20px; | 760 | padding: 20px; |
814 | background: pvar(--submenuColor); | 761 | background: pvar(--submenuBackgroundColor); |
815 | border-radius: 4px; | 762 | border-radius: 4px; |
816 | box-sizing: border-box; | 763 | box-sizing: border-box; |
817 | height: 100%; | 764 | height: 100%; |
@@ -833,7 +780,7 @@ | |||
833 | } | 780 | } |
834 | } | 781 | } |
835 | 782 | ||
836 | @mixin divider($color: pvar(--submenuColor), $background: pvar(--mainBackgroundColor)) { | 783 | @mixin divider($color: pvar(--submenuBackgroundColor), $background: pvar(--mainBackgroundColor)) { |
837 | width: 95%; | 784 | width: 95%; |
838 | border-top: .05rem solid $color; | 785 | border-top: .05rem solid $color; |
839 | height: .05rem; | 786 | height: .05rem; |
@@ -916,7 +863,7 @@ | |||
916 | } | 863 | } |
917 | } | 864 | } |
918 | 865 | ||
919 | @mixin admin-sub-header-responsive ($horizontal-margins) { | 866 | @mixin admin-sub-header-responsive { |
920 | flex-direction: column; | 867 | flex-direction: column; |
921 | 868 | ||
922 | .form-sub-title { | 869 | .form-sub-title { |
@@ -931,7 +878,7 @@ | |||
931 | white-space: nowrap; | 878 | white-space: nowrap; |
932 | height: 50px; | 879 | height: 50px; |
933 | padding: 10px 0; | 880 | padding: 10px 0; |
934 | width: calc(100vw - #{$horizontal-margins*2}); | 881 | width: 100%; |
935 | 882 | ||
936 | a { | 883 | a { |
937 | margin-left: 5px; | 884 | margin-left: 5px; |
@@ -939,14 +886,16 @@ | |||
939 | } | 886 | } |
940 | } | 887 | } |
941 | 888 | ||
942 | // applies 16:9 ratio to a child element (using $selector) only using | 889 | // applies ratio (default to 16:9) to a child element (using $selector) only using |
943 | // an immediate's parent size. This allows 16:9 ratio without explicit | 890 | // an immediate's parent size. This allows to set a ratio without explicit |
944 | // dimensions, as width/height cannot be computed from each other. | 891 | // dimensions, as width/height cannot be computed from each other. |
945 | @mixin large-screen-ratio ($selector: 'div') { | 892 | @mixin block-ratio ($selector: 'div', $inverted-ratio: 9/16) { |
893 | $padding-percent: percentage($inverted-ratio); | ||
894 | |||
946 | position: relative; | 895 | position: relative; |
947 | height: 0; | 896 | height: 0; |
948 | width: 100%; | 897 | width: 100%; |
949 | padding-top: 56%; | 898 | padding-top: $padding-percent; |
950 | 899 | ||
951 | #{$selector} { | 900 | #{$selector} { |
952 | position: absolute; | 901 | position: absolute; |
@@ -991,3 +940,31 @@ | |||
991 | 940 | ||
992 | border-left: $width solid rgba(255, 255, 255, 0.95); | 941 | border-left: $width solid rgba(255, 255, 255, 0.95); |
993 | } | 942 | } |
943 | |||
944 | @mixin on-small-main-col () { | ||
945 | :host-context(.main-col:not(.expanded)) { | ||
946 | @media screen and (max-width: $small-view + $menu-width) { | ||
947 | @content; | ||
948 | } | ||
949 | } | ||
950 | |||
951 | :host-context(.main-col.expanded) { | ||
952 | @media screen and (max-width: $small-view) { | ||
953 | @content; | ||
954 | } | ||
955 | } | ||
956 | } | ||
957 | |||
958 | @mixin on-mobile-main-col () { | ||
959 | :host-context(.main-col:not(.expanded)) { | ||
960 | @media screen and (max-width: $mobile-view + $menu-width) { | ||
961 | @content; | ||
962 | } | ||
963 | } | ||
964 | |||
965 | :host-context(.main-col.expanded) { | ||
966 | @media screen and (max-width: $mobile-view) { | ||
967 | @content; | ||
968 | } | ||
969 | } | ||
970 | } | ||