diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-06-09 09:33:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 09:33:28 +0200 |
commit | e66883b37ae0796256b3aba550670a2d76cfc98a (patch) | |
tree | 3cce3c78e9f9f327470f0370a1b4065fe7e0009e /client/src/sass/include | |
parent | 6ad971d5f5e9ea2adfc58bd83ba1790efa4a8d12 (diff) | |
download | PeerTube-e66883b37ae0796256b3aba550670a2d76cfc98a.tar.gz PeerTube-e66883b37ae0796256b3aba550670a2d76cfc98a.tar.zst PeerTube-e66883b37ae0796256b3aba550670a2d76cfc98a.zip |
`fitWidth` for `video-miniature`, fluid grid (#2830)
* Fluid abstract video list
* normalize timestamp display on miniatures
* use grid for abstract-video-list
- refactor scss function var to pvar to avoid overriding css variables
- move fluid-grid margins to adapt-margin-content-width mixin for maintainability
- fix video-miniature-name margin-top on small screen
* move sceenratio function in a mixin
* display no miniature avatar in channel videos view
Diffstat (limited to 'client/src/sass/include')
-rw-r--r-- | client/src/sass/include/_miniature.scss | 55 | ||||
-rw-r--r-- | client/src/sass/include/_mixins.scss | 86 | ||||
-rw-r--r-- | client/src/sass/include/_variables.scss | 2 |
3 files changed, 83 insertions, 60 deletions
diff --git a/client/src/sass/include/_miniature.scss b/client/src/sass/include/_miniature.scss index d0ee1e2f0..d89d6f9ff 100644 --- a/client/src/sass/include/_miniature.scss +++ b/client/src/sass/include/_miniature.scss | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | transition: color 0.2s; | 7 | transition: color 0.2s; |
8 | font-weight: $font-semibold; | 8 | font-weight: $font-semibold; |
9 | color: var(--mainForegroundColor); | 9 | color: pvar(--mainForegroundColor); |
10 | margin-top: 10px; | 10 | margin-top: 10px; |
11 | margin-bottom: 5px; | 11 | margin-bottom: 5px; |
12 | 12 | ||
@@ -80,7 +80,7 @@ $play-overlay-width: 18px; | |||
80 | } | 80 | } |
81 | 81 | ||
82 | &.focus-visible { | 82 | &.focus-visible { |
83 | box-shadow: #{$focus-box-shadow-form} var(--mainColorLightest); | 83 | box-shadow: #{$focus-box-shadow-form} pvar(--mainColorLightest); |
84 | outline: none; | 84 | outline: none; |
85 | } | 85 | } |
86 | 86 | ||
@@ -168,7 +168,7 @@ $play-overlay-width: 18px; | |||
168 | outline: none; | 168 | outline: none; |
169 | } | 169 | } |
170 | 170 | ||
171 | color: var(--mainForegroundColor); | 171 | color: pvar(--mainForegroundColor); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
@@ -187,7 +187,7 @@ $play-overlay-width: 18px; | |||
187 | } | 187 | } |
188 | 188 | ||
189 | .followers { | 189 | .followers { |
190 | color: var(--greyForegroundColor); | 190 | color: pvar(--greyForegroundColor); |
191 | font-weight: normal; | 191 | font-weight: normal; |
192 | font-size: 14px; | 192 | font-size: 14px; |
193 | margin-left: 10px; | 193 | margin-left: 10px; |
@@ -203,7 +203,7 @@ $play-overlay-width: 18px; | |||
203 | display: inline-block; | 203 | display: inline-block; |
204 | font-size: 16px; | 204 | font-size: 16px; |
205 | text-transform: uppercase; | 205 | text-transform: uppercase; |
206 | color: var(--greyForegroundColor); | 206 | color: pvar(--greyForegroundColor); |
207 | margin-bottom: 10px; | 207 | margin-bottom: 10px; |
208 | font-weight: $font-semibold; | 208 | font-weight: $font-semibold; |
209 | text-decoration: none; | 209 | text-decoration: none; |
@@ -221,32 +221,37 @@ $play-overlay-width: 18px; | |||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | @mixin adapt-margin-content-width { | 224 | @mixin adapt-margin-content-width($fluid: false) { |
225 | width: $video-miniature-width * 6; | 225 | @if $fluid { |
226 | margin: auto !important; | 226 | margin-left: 3vw !important; |
227 | margin-right: 3vw !important; | ||
228 | } @else { | ||
229 | width: $video-miniature-width * 6; | ||
230 | margin: auto !important; | ||
227 | 231 | ||
228 | @media screen and (max-width: 1800px) { | 232 | @media screen and (max-width: 1800px) { |
229 | width: $video-miniature-width * 5; | 233 | width: $video-miniature-width * 5; |
230 | } | 234 | } |
231 | 235 | ||
232 | @media screen and (max-width: 1800px - $video-miniature-width) { | 236 | @media screen and (max-width: 1800px - $video-miniature-width) { |
233 | width: $video-miniature-width * 4; | 237 | width: $video-miniature-width * 4; |
234 | } | 238 | } |
235 | 239 | ||
236 | @media screen and (max-width: 1800px - (2* $video-miniature-width)) { | 240 | @media screen and (max-width: 1800px - (2* $video-miniature-width)) { |
237 | width: $video-miniature-width * 3; | 241 | width: $video-miniature-width * 3; |
238 | } | 242 | } |
239 | 243 | ||
240 | @media screen and (max-width: 1800px - (3* $video-miniature-width)) { | 244 | @media screen and (max-width: 1800px - (3* $video-miniature-width)) { |
241 | width: $video-miniature-width * 2; | 245 | width: $video-miniature-width * 2; |
242 | } | 246 | } |
243 | 247 | ||
244 | @media screen and (max-width: $mobile-view) { | 248 | @media screen and (max-width: $mobile-view) { |
245 | width: auto; | 249 | width: auto; |
246 | margin: 0 !important; | 250 | margin: 0 !important; |
247 | 251 | ||
248 | .videos { | 252 | .videos { |
249 | @include video-miniature-small-screen; | 253 | @include video-miniature-small-screen; |
254 | } | ||
250 | } | 255 | } |
251 | } | 256 | } |
252 | } | 257 | } |
diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scss index 0b558a3f5..5971bb72a 100644 --- a/client/src/sass/include/_mixins.scss +++ b/client/src/sass/include/_mixins.scss | |||
@@ -90,8 +90,8 @@ | |||
90 | display: inline-block; | 90 | display: inline-block; |
91 | height: $button-height; | 91 | height: $button-height; |
92 | width: $width; | 92 | width: $width; |
93 | color: var(--inputForegroundColor); | 93 | color: pvar(--inputForegroundColor); |
94 | background-color: var(--inputBackgroundColor); | 94 | background-color: pvar(--inputBackgroundColor); |
95 | border: 1px solid #C6C6C6; | 95 | border: 1px solid #C6C6C6; |
96 | border-radius: 3px; | 96 | border-radius: 3px; |
97 | padding-left: 15px; | 97 | padding-left: 15px; |
@@ -99,7 +99,7 @@ | |||
99 | font-size: 15px; | 99 | font-size: 15px; |
100 | 100 | ||
101 | &::placeholder { | 101 | &::placeholder { |
102 | color: var(--inputPlaceholderColor); | 102 | color: pvar(--inputPlaceholderColor); |
103 | } | 103 | } |
104 | 104 | ||
105 | @media screen and (max-width: $width) { | 105 | @media screen and (max-width: $width) { |
@@ -122,24 +122,24 @@ | |||
122 | @mixin peertube-textarea ($width, $height) { | 122 | @mixin peertube-textarea ($width, $height) { |
123 | @include peertube-input-text($width); | 123 | @include peertube-input-text($width); |
124 | 124 | ||
125 | color: var(--textareaForegroundColor); | 125 | color: pvar(--textareaForegroundColor); |
126 | background-color: var(--textareaBackgroundColor); | 126 | background-color: pvar(--textareaBackgroundColor); |
127 | height: $height; | 127 | height: $height; |
128 | padding: 5px 15px; | 128 | padding: 5px 15px; |
129 | font-size: 15px; | 129 | font-size: 15px; |
130 | } | 130 | } |
131 | 131 | ||
132 | @mixin orange-button { | 132 | @mixin orange-button { |
133 | @include button-focus(var(--mainColorLightest)); | 133 | @include button-focus(pvar(--mainColorLightest)); |
134 | 134 | ||
135 | &, &:active, &:focus { | 135 | &, &:active, &:focus { |
136 | color: #fff; | 136 | color: #fff; |
137 | background-color: var(--mainColor); | 137 | background-color: pvar(--mainColor); |
138 | } | 138 | } |
139 | 139 | ||
140 | &:hover { | 140 | &:hover { |
141 | color: #fff; | 141 | color: #fff; |
142 | background-color: var(--mainHoverColor); | 142 | background-color: pvar(--mainHoverColor); |
143 | } | 143 | } |
144 | 144 | ||
145 | &[disabled], &.disabled { | 145 | &[disabled], &.disabled { |
@@ -156,7 +156,7 @@ | |||
156 | @mixin tertiary-button { | 156 | @mixin tertiary-button { |
157 | @include button-focus($grey-button-outline-color); | 157 | @include button-focus($grey-button-outline-color); |
158 | 158 | ||
159 | color: var(--greyForegroundColor); | 159 | color: pvar(--greyForegroundColor); |
160 | background-color: transparent; | 160 | background-color: transparent; |
161 | 161 | ||
162 | &[disabled], &.disabled { | 162 | &[disabled], &.disabled { |
@@ -173,11 +173,11 @@ | |||
173 | 173 | ||
174 | &, &:active, &:focus { | 174 | &, &:active, &:focus { |
175 | background-color: $grey-background-color; | 175 | background-color: $grey-background-color; |
176 | color: var(--greyForegroundColor); | 176 | color: pvar(--greyForegroundColor); |
177 | } | 177 | } |
178 | 178 | ||
179 | &:hover, &:active, &:focus, &[disabled], &.disabled { | 179 | &:hover, &:active, &:focus, &[disabled], &.disabled { |
180 | color: var(--greyForegroundColor); | 180 | color: pvar(--greyForegroundColor); |
181 | background-color: $grey-background-hover-color; | 181 | background-color: $grey-background-hover-color; |
182 | } | 182 | } |
183 | 183 | ||
@@ -186,7 +186,7 @@ | |||
186 | } | 186 | } |
187 | 187 | ||
188 | my-global-icon { | 188 | my-global-icon { |
189 | @include apply-svg-color(var(--greyForegroundColor)) | 189 | @include apply-svg-color(pvar(--greyForegroundColor)) |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
@@ -283,8 +283,8 @@ | |||
283 | margin: 0; | 283 | margin: 0; |
284 | width: $width; | 284 | width: $width; |
285 | border-radius: 3px; | 285 | border-radius: 3px; |
286 | color: var(--inputForegroundColor); | 286 | color: pvar(--inputForegroundColor); |
287 | background: var(--inputBackgroundColor); | 287 | background: pvar(--inputBackgroundColor); |
288 | position: relative; | 288 | position: relative; |
289 | font-size: 15px; | 289 | font-size: 15px; |
290 | 290 | ||
@@ -315,7 +315,7 @@ | |||
315 | cursor: pointer; | 315 | cursor: pointer; |
316 | height: $button-height; | 316 | height: $button-height; |
317 | text-overflow: ellipsis; | 317 | text-overflow: ellipsis; |
318 | color: var(--mainForegroundColor); | 318 | color: pvar(--mainForegroundColor); |
319 | 319 | ||
320 | &:focus { | 320 | &:focus { |
321 | outline: none; | 321 | outline: none; |
@@ -375,7 +375,7 @@ | |||
375 | position: absolute; | 375 | position: absolute; |
376 | 376 | ||
377 | &:focus + span { | 377 | &:focus + span { |
378 | box-shadow: #{$focus-box-shadow-form} var(--mainColorLightest); | 378 | box-shadow: #{$focus-box-shadow-form} pvar(--mainColorLightest); |
379 | } | 379 | } |
380 | 380 | ||
381 | & + span { | 381 | & + span { |
@@ -404,7 +404,7 @@ | |||
404 | 404 | ||
405 | &:checked + span { | 405 | &:checked + span { |
406 | border-color: transparent; | 406 | border-color: transparent; |
407 | background: var(--mainColor); | 407 | background: pvar(--mainColor); |
408 | animation: jelly 0.6s ease; | 408 | animation: jelly 0.6s ease; |
409 | 409 | ||
410 | &:after { | 410 | &:after { |
@@ -464,14 +464,14 @@ | |||
464 | 464 | ||
465 | @mixin in-content-small-title { | 465 | @mixin in-content-small-title { |
466 | text-transform: uppercase; | 466 | text-transform: uppercase; |
467 | color: var(--mainColor); | 467 | color: pvar(--mainColor); |
468 | font-weight: $font-bold; | 468 | font-weight: $font-bold; |
469 | font-size: 13px; | 469 | font-size: 13px; |
470 | } | 470 | } |
471 | 471 | ||
472 | @mixin settings-big-title { | 472 | @mixin settings-big-title { |
473 | text-transform: uppercase; | 473 | text-transform: uppercase; |
474 | color: var(--mainColor); | 474 | color: pvar(--mainColor); |
475 | font-weight: $font-bold; | 475 | font-weight: $font-bold; |
476 | font-size: 110%; | 476 | font-size: 110%; |
477 | margin-bottom: 10px; | 477 | margin-bottom: 10px; |
@@ -482,7 +482,7 @@ | |||
482 | 482 | ||
483 | font-size: 13px; | 483 | font-size: 13px; |
484 | margin-top: 4px; | 484 | margin-top: 4px; |
485 | color: var(--mainForegroundColor); | 485 | color: pvar(--mainForegroundColor); |
486 | 486 | ||
487 | span:hover { | 487 | span:hover { |
488 | opacity: 0.8; | 488 | opacity: 0.8; |
@@ -612,8 +612,8 @@ | |||
612 | border-radius: 0.25rem; | 612 | border-radius: 0.25rem; |
613 | 613 | ||
614 | .progress-bar { | 614 | .progress-bar { |
615 | color: var(--mainBackgroundColor); | 615 | color: pvar(--mainBackgroundColor); |
616 | background-color: var(--mainColor); | 616 | background-color: pvar(--mainColor); |
617 | display: flex; | 617 | display: flex; |
618 | flex-direction: column; | 618 | flex-direction: column; |
619 | justify-content: center; | 619 | justify-content: center; |
@@ -622,7 +622,7 @@ | |||
622 | transition: width 0.6s ease; | 622 | transition: width 0.6s ease; |
623 | 623 | ||
624 | &.secondary { | 624 | &.secondary { |
625 | background-color: var(--secondaryColor); | 625 | background-color: pvar(--secondaryColor); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | } | 628 | } |
@@ -633,14 +633,14 @@ | |||
633 | padding: 0.75rem 1rem; | 633 | padding: 0.75rem 1rem; |
634 | margin-bottom: 1rem; | 634 | margin-bottom: 1rem; |
635 | list-style: none; | 635 | list-style: none; |
636 | background-color: var(--submenuColor); | 636 | background-color: pvar(--submenuColor); |
637 | border-radius: 0.25rem; | 637 | border-radius: 0.25rem; |
638 | 638 | ||
639 | .breadcrumb-item { | 639 | .breadcrumb-item { |
640 | display: flex; | 640 | display: flex; |
641 | 641 | ||
642 | a { | 642 | a { |
643 | color: var(--mainColor); | 643 | color: pvar(--mainColor); |
644 | } | 644 | } |
645 | 645 | ||
646 | & + .breadcrumb-item { | 646 | & + .breadcrumb-item { |
@@ -688,7 +688,7 @@ | |||
688 | & > a, | 688 | & > a, |
689 | & > div { | 689 | & > div { |
690 | padding: 20px; | 690 | padding: 20px; |
691 | background: var(--submenuColor); | 691 | background: pvar(--submenuColor); |
692 | border-radius: 4px; | 692 | border-radius: 4px; |
693 | box-sizing: border-box; | 693 | box-sizing: border-box; |
694 | height: 100%; | 694 | height: 100%; |
@@ -699,14 +699,14 @@ | |||
699 | text-align: center; | 699 | text-align: center; |
700 | font-size: 130%; | 700 | font-size: 130%; |
701 | line-height: 21px; | 701 | line-height: 21px; |
702 | color: var(--mainForegroundColor); | 702 | color: pvar(--mainForegroundColor); |
703 | line-height: 30px; | 703 | line-height: 30px; |
704 | margin-bottom: 20px; | 704 | margin-bottom: 20px; |
705 | } | 705 | } |
706 | 706 | ||
707 | .dashboard-label { | 707 | .dashboard-label { |
708 | font-size: 90%; | 708 | font-size: 90%; |
709 | color: var(--inputPlaceholderColor); | 709 | color: pvar(--inputPlaceholderColor); |
710 | text-align: center; | 710 | text-align: center; |
711 | } | 711 | } |
712 | } | 712 | } |
@@ -726,7 +726,7 @@ | |||
726 | height: max-content; | 726 | height: max-content; |
727 | 727 | ||
728 | &:focus-within { | 728 | &:focus-within { |
729 | box-shadow: #{$focus-box-shadow-form} var(--mainColorLightest); | 729 | box-shadow: #{$focus-box-shadow-form} pvar(--mainColorLightest); |
730 | } | 730 | } |
731 | } | 731 | } |
732 | 732 | ||
@@ -735,8 +735,8 @@ | |||
735 | height: 30px !important; | 735 | height: 30px !important; |
736 | font-size: 12px !important; | 736 | font-size: 12px !important; |
737 | 737 | ||
738 | background-color: var(--mainBackgroundColor) !important; | 738 | background-color: pvar(--mainBackgroundColor) !important; |
739 | color: var(--mainForegroundColor) !important; | 739 | color: pvar(--mainForegroundColor) !important; |
740 | } | 740 | } |
741 | } | 741 | } |
742 | 742 | ||
@@ -769,7 +769,7 @@ | |||
769 | vertical-align: middle !important; | 769 | vertical-align: middle !important; |
770 | 770 | ||
771 | path { | 771 | path { |
772 | fill: var(--greyForegroundColor) !important; | 772 | fill: pvar(--greyForegroundColor) !important; |
773 | } | 773 | } |
774 | } | 774 | } |
775 | 775 | ||
@@ -780,7 +780,7 @@ | |||
780 | } | 780 | } |
781 | } | 781 | } |
782 | 782 | ||
783 | @mixin divider($color: var(--submenuColor), $background: var(--mainBackgroundColor)) { | 783 | @mixin divider($color: pvar(--submenuColor), $background: pvar(--mainBackgroundColor)) { |
784 | width: 95%; | 784 | width: 95%; |
785 | border-top: .05rem solid $color; | 785 | border-top: .05rem solid $color; |
786 | height: .05rem; | 786 | height: .05rem; |
@@ -810,7 +810,7 @@ | |||
810 | border-radius: 5rem; | 810 | border-radius: 5rem; |
811 | display: inline-flex; | 811 | display: inline-flex; |
812 | font-size: 90%; | 812 | font-size: 90%; |
813 | color: var(--mainForegroundColor); | 813 | color: pvar(--mainForegroundColor); |
814 | height: $avatar-height; | 814 | height: $avatar-height; |
815 | line-height: 1rem; | 815 | line-height: 1rem; |
816 | margin: .1rem; | 816 | margin: .1rem; |
@@ -887,3 +887,21 @@ | |||
887 | } | 887 | } |
888 | } | 888 | } |
889 | } | 889 | } |
890 | |||
891 | // applies 16:9 ratio to a child element (using $selector) only using | ||
892 | // an immediate's parent size. This allows 16:9 ratio without explicit | ||
893 | // dimensions, as width/height cannot be computed from each other. | ||
894 | @mixin large-screen-ratio ($selector: 'div') { | ||
895 | position: relative; | ||
896 | height: 0; | ||
897 | width: 100%; | ||
898 | padding-top: 56%; | ||
899 | |||
900 | #{$selector} { | ||
901 | position: absolute; | ||
902 | width: 100%; | ||
903 | height: 100%; | ||
904 | top: 0; | ||
905 | @content; | ||
906 | } | ||
907 | } | ||
diff --git a/client/src/sass/include/_variables.scss b/client/src/sass/include/_variables.scss index 11561e268..14f1ae76c 100644 --- a/client/src/sass/include/_variables.scss +++ b/client/src/sass/include/_variables.scss | |||
@@ -116,7 +116,7 @@ $variables: ( | |||
116 | --embedBigPlayBackgroundColor: var(--embedBigPlayBackgroundColor) | 116 | --embedBigPlayBackgroundColor: var(--embedBigPlayBackgroundColor) |
117 | ); | 117 | ); |
118 | 118 | ||
119 | @function var($variable) { | 119 | @function pvar($variable) { |
120 | @return map-get($variables, $variable); | 120 | @return map-get($variables, $variable); |
121 | } | 121 | } |
122 | 122 | ||