]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/sass/include/_mixins.scss
Add visitor settings, rework logged-in dropdown (#2514)
[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
17@mixin ellipsis {
18 white-space: nowrap;
19 overflow: hidden;
20 text-overflow: ellipsis;
21}
22
23@mixin ellipsis-multiline($font-size: 16px, $number-of-lines: 2) {
24 display: block;
25 /* Fallback for non-webkit */
26 display: -webkit-box;
27 max-height: $font-size * $number-of-lines;
28 /* Fallback for non-webkit */
29 font-size: $font-size;
30 line-height: $font-size;
31 overflow: hidden;
32 text-overflow: ellipsis;
33}
34
35@mixin prefix($property, $parameters...) {
36 @each $prefix in -webkit-, -moz-, -ms-, -o-, "" {
37 #{$prefix}#{$property}: $parameters;
38 }
39}
40
41@mixin peertube-word-wrap {
42 word-break: break-word;
43 word-wrap: break-word;
44 overflow-wrap: break-word;
45 -webkit-hyphens: auto;
46 -ms-hyphens: auto;
47 -moz-hyphens: auto;
48 hyphens: auto;
49}
50
51@mixin apply-svg-color ($color) {
52 ::ng-deep svg {
53 path[fill="#000000"],
54 g[fill="#000000"],
55 rect[fill="#000000"],
56 circle[fill="#000000"],
57 polygon[fill="#000000"] {
58 fill: $color;
59 }
60
61 path[stroke="#000000"],
62 g[stroke="#000000"],
63 rect[stroke="#000000"],
64 circle[stroke="#000000"],
65 polygon[stroke="#000000"] {
66 stroke: $color;
67 }
68
69 stop[stop-color="#000000"] {
70 stop-color: $color;
71 }
72 }
73}
74
75@mixin fill-svg-color ($color) {
76 ::ng-deep svg {
77 path {
78 fill: $color;
79 }
80 }
81}
82
83@mixin button-focus-visible-shadow($color) {
84 &.focus-visible {
85 box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px $color;
86 }
87}
88
89@mixin peertube-input-text($width) {
90 display: inline-block;
91 height: $button-height;
92 width: $width;
93 background: var(--inputBackgroundColor);
94 border: 1px solid #C6C6C6;
95 border-radius: 3px;
96 padding-left: 15px;
97 padding-right: 15px;
98 font-size: 15px;
99
100 &::placeholder {
101 color: var(--inputPlaceholderColor);
102 }
103
104 @media screen and (max-width: $width) {
105 width: 100%;
106 }
107}
108
109@mixin peertube-input-group($width) {
110 width: $width;
111 min-height: $button-height;
112 padding-top: 0;
113 padding-bottom: 0;
114
115 .input-group-text{
116 font-size: 14px;
117 color: gray;
118 }
119}
120
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
129@mixin orange-button {
130 @include button-focus-visible-shadow(var(--mainHoverColor));
131
132 &, &:active, &:focus {
133 color: #fff;
134 background-color: var(--mainColor);
135 }
136
137 &:hover {
138 color: #fff;
139 background-color: var(--mainHoverColor);
140 }
141
142 &[disabled], &.disabled {
143 cursor: default;
144 color: #fff;
145 background-color: #C6C6C6;
146 }
147
148 my-global-icon {
149 @include apply-svg-color(#fff)
150 }
151}
152
153@mixin grey-button {
154 &, &:active, &:focus {
155 background-color: $grey-background-color;
156 color: $grey-foreground-color;
157 }
158
159 &:hover, &:active, &:focus, &[disabled], &.disabled {
160 color: $grey-foreground-color;
161 background-color: $grey-background-hover-color;
162 }
163
164 &[disabled], &.disabled {
165 cursor: default;
166 }
167
168 my-global-icon {
169 @include apply-svg-color($grey-foreground-color)
170 }
171}
172
173@mixin peertube-button {
174 border: none;
175 font-weight: $font-semibold;
176 font-size: 15px;
177 height: $button-height;
178 line-height: $button-height;
179 border-radius: 3px;
180 text-align: center;
181 padding: 0 17px 0 13px;
182 cursor: pointer;
183}
184
185@mixin peertube-button-link {
186 display: inline-block;
187
188 @include disable-default-a-behaviour;
189 @include peertube-button;
190}
191
192@mixin peertube-button-outline {
193 display: inline-block;
194
195 @include disable-default-a-behaviour;
196 @include peertube-button;
197
198 border: 1px solid;
199}
200
201@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) {
202 my-global-icon {
203 position: relative;
204 width: $width;
205 margin-right: $margin-right;
206 top: $top;
207 }
208}
209
210@mixin peertube-button-file ($width) {
211 position: relative;
212 overflow: hidden;
213 display: inline-block;
214 width: $width;
215
216 @include peertube-button;
217 @include orange-button;
218
219 input[type=file] {
220 position: absolute;
221 top: 0;
222 right: 0;
223 min-width: 100%;
224 min-height: 100%;
225 font-size: 100px;
226 text-align: right;
227 filter: alpha(opacity=0);
228 opacity: 0;
229 outline: none;
230 background: white;
231 cursor: inherit;
232 display: block;
233 }
234}
235
236@mixin icon ($size) {
237 display: inline-block;
238 background-repeat: no-repeat;
239 background-size: contain;
240 width: $size;
241 height: $size;
242 vertical-align: middle;
243 cursor: pointer;
244}
245
246@mixin select-arrow-down {
247 top: 50%;
248 right: calc(0% + 15px);
249 content: " ";
250 height: 0;
251 width: 0;
252 position: absolute;
253 pointer-events: none;
254 border: 5px solid rgba(0, 0, 0, 0);
255 border-top-color: #000;
256 margin-top: -2px;
257 z-index: 100;
258}
259
260@mixin peertube-select-container ($width) {
261 padding: 0;
262 margin: 0;
263 border: 1px solid #C6C6C6;
264 width: $width;
265 border-radius: 3px;
266 overflow: hidden;
267 background: var(--inputBackgroundColor);
268 position: relative;
269 font-size: 15px;
270
271 &.disabled {
272 background-color: #E5E5E5;
273
274 select {
275 cursor: default;
276 }
277 }
278
279 @media screen and (max-width: $width) {
280 width: 100%;
281 }
282
283 &:after {
284 @include select-arrow-down;
285 }
286
287 select {
288 padding: 0 35px 0 12px;
289 width: calc(100% + 2px);
290 position: relative;
291 left: 1px;
292 border: none;
293 box-shadow: none;
294 background: transparent none;
295 appearance: none;
296 cursor: pointer;
297 height: $button-height;
298 text-overflow: ellipsis;
299 color: var(--mainForegroundColor);
300
301 &:focus {
302 outline: none;
303 }
304
305 &:-moz-focusring {
306 color: transparent;
307 text-shadow: 0 0 0 #000;
308 }
309
310 option {
311 color: #000;
312 }
313 }
314}
315
316// Thanks: https://codepen.io/triss90/pen/XNEdRe/
317@mixin peertube-radio-container {
318 input[type="radio"] {
319 display: none;
320
321 & + label {
322 font-weight: $font-regular;
323 cursor: pointer;
324
325 &:before {
326 position: relative;
327 top: -2px;
328 content: '';
329 background: #fff;
330 border-radius: 100%;
331 border: 1px solid #000;
332 display: inline-block;
333 width: 15px;
334 height: 15px;
335 vertical-align: middle;
336 cursor: pointer;
337 text-align: center;
338 margin-right: 10px;
339 }
340 }
341
342 &:checked + label:before {
343 background-color: #000;
344 box-shadow: inset 0 0 0 4px #fff;
345 }
346
347 &:focus + label:before {
348 outline: none;
349 border-color: #000;
350 }
351 }
352}
353
354@mixin peertube-checkbox ($border-width) {
355 opacity: 0;
356 position: absolute;
357
358 &:focus + span {
359 box-shadow: 0 0 0 .1rem rgba(87, 85, 217, .2);
360 }
361
362 & + span {
363 position: relative;
364 width: 18px;
365 min-width: 18px;
366 height: 18px;
367 border: $border-width solid $fg-color;
368 border-radius: 3px;
369 vertical-align: middle;
370 cursor: pointer;
371
372 &:after {
373 content: '';
374 position: absolute;
375 top: calc(2px - #{$border-width});
376 left: 5px;
377 width: 5px;
378 height: 12px;
379 opacity: 0;
380 transform: rotate(45deg) scale(0);
381 border-right: 2px solid $bg-color;
382 border-bottom: 2px solid $bg-color;
383 }
384 }
385
386 &:checked + span {
387 border-color: transparent;
388 background: $orange-color;
389 animation: jelly 0.6s ease;
390
391 &:after {
392 opacity: 1;
393 transform: rotate(45deg) scale(1);
394 }
395 }
396
397 & + span + span {
398 font-size: 15px;
399 font-weight: $font-regular;
400 margin-left: 5px;
401 cursor: pointer;
402 display: inline;
403 }
404
405 &[disabled] + span,
406 &[disabled] + span + span{
407 opacity: 0.5;
408 cursor: default;
409 }
410}
411
412
413@mixin avatar ($size) {
414 object-fit: cover;
415 border-radius: 50%;
416 width: $size;
417 height: $size;
418 min-width: $size;
419 min-height: $size;
420}
421
422@mixin chevron ($size, $border-width) {
423 border-style: solid;
424 border-width: $border-width $border-width 0 0;
425 content: '';
426 display: inline-block;
427 transform: rotate(-45deg);
428 height: $size;
429 width: $size;
430}
431
432@mixin chevron-right ($size, $border-width) {
433 @include chevron($size, $border-width);
434
435 left: 0;
436 transform: rotate(45deg);
437}
438
439@mixin chevron-left ($size, $border-width) {
440 @include chevron($size, $border-width);
441
442 left: 0.25em;
443 transform: rotate(-135deg);
444}
445
446@mixin in-content-small-title {
447 text-transform: uppercase;
448 color: var(--mainColor);
449 font-weight: $font-bold;
450 font-size: 13px;
451}
452
453@mixin actor-owner {
454 @include disable-default-a-behaviour;
455
456 font-size: 13px;
457 margin-top: 4px;
458 color: var(--mainForegroundColor);
459
460 span:hover {
461 opacity: 0.8;
462 }
463
464 img {
465 @include avatar(18px);
466
467 margin-left: 7px;
468 position: relative;
469 top: -2px;
470 }
471}
472
473@mixin sub-menu-with-actor {
474 height: max-content;
475 display: flex;
476 flex-direction: column;
477 align-items: flex-start;
478
479 .actor {
480 display: flex;
481 margin-top: 20px;
482 margin-bottom: 20px;
483
484 img {
485 @include avatar(80px);
486
487 margin-right: 20px;
488 }
489
490 .actor-info {
491 display: flex;
492 flex-direction: column;
493 justify-content: center;
494
495 .actor-names {
496 display: flex;
497 align-items: center;
498 flex-wrap: wrap;
499
500 .actor-display-name {
501 font-size: 23px;
502 font-weight: $font-bold;
503 margin-right: 7px;
504 }
505
506 .actor-name {
507 position: relative;
508 top: 3px;
509 font-size: 14px;
510 color: $grey-actor-name;
511 }
512 }
513
514 .actor-lower {
515 grid-area: lower;
516 }
517
518 .actor-followers {
519 font-size: 15px;
520 }
521
522 .actor-owner {
523 @include actor-owner;
524 }
525 }
526 }
527
528 .links {
529 margin-top: 0;
530 margin-bottom: 10px;
531
532 a {
533 margin-top: 0;
534 margin-bottom: 0;
535 text-transform: uppercase;
536 font-weight: 600;
537 font-size: 110%;
538
539 @media screen and (max-width: $mobile-view) {
540 font-size: 130%;
541 }
542 }
543 }
544}
545
546@mixin create-button {
547 @include peertube-button-link;
548 @include orange-button;
549 @include button-with-icon(20px, 5px, -1px);
550}
551
552@mixin row-blocks {
553 display: flex;
554 min-height: 130px;
555 padding-bottom: 20px;
556 margin-bottom: 20px;
557 border-bottom: 1px solid #C6C6C6;
558
559 @media screen and (max-width: 800px) {
560 flex-direction: column;
561 height: auto;
562 align-items: center;
563 }
564}
565
566@mixin dropdown-with-icon-item {
567 padding: 6px 15px;
568
569 my-global-icon {
570 width: 22px;
571 opacity: .7;
572
573 margin-right: 10px;
574 position: relative;
575 top: -2px;
576 }
577}