]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
Share modal light UI simplification
[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
17@mixin ellipsis {
18 white-space: nowrap;
19 overflow: hidden;
20 text-overflow: ellipsis;
21}
0c9945d9
C
22
23@mixin ellipsis-multiline($font-size: 16px, $number-of-lines: 2) {
769ac6c1
RK
24 display: block;
25 /* Fallback for non-webkit */
26 display: -webkit-box;
0c9945d9 27 max-height: $font-size * $number-of-lines;
769ac6c1
RK
28 /* Fallback for non-webkit */
29 font-size: $font-size;
8fc02e47 30 line-height: $font-size;
769ac6c1
RK
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
7a14004b 41@mixin peertube-word-wrap {
fc641ded 42 word-break: break-word;
7a14004b
C
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;
7a14004b
C
49}
50
457bb213 51@mixin apply-svg-color ($color) {
03652b31 52 ::ng-deep svg {
a55052c9
C
53 path[fill="#000000"],
54 g[fill="#000000"],
55 rect[fill="#000000"],
56 circle[fill="#000000"],
57 polygon[fill="#000000"] {
457bb213
C
58 fill: $color;
59 }
60
a55052c9
C
61 path[stroke="#000000"],
62 g[stroke="#000000"],
63 rect[stroke="#000000"],
64 circle[stroke="#000000"],
65 polygon[stroke="#000000"] {
457bb213
C
66 stroke: $color;
67 }
a55052c9
C
68
69 stop[stop-color="#000000"] {
70 stop-color: $color;
71 }
457bb213
C
72 }
73}
74
d3217560
RK
75@mixin fill-svg-color ($color) {
76 ::ng-deep svg {
77 path {
78 fill: $color;
79 }
80 }
81}
82
e40afb5b
RK
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
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 {
e40afb5b
RK
130 @include button-focus-visible-shadow(var(--mainHoverColor));
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
153@mixin grey-button {
15a7387d 154 &, &:active, &:focus {
457bb213
C
155 background-color: $grey-background-color;
156 color: $grey-foreground-color;
15a7387d 157 }
7b272fd7 158
4cc66133 159 &:hover, &:active, &:focus, &[disabled], &.disabled {
457bb213
C
160 color: $grey-foreground-color;
161 background-color: $grey-background-hover-color;
7b272fd7 162 }
4cc66133
C
163
164 &[disabled], &.disabled {
165 cursor: default;
166 }
457bb213
C
167
168 my-global-icon {
169 @include apply-svg-color($grey-foreground-color)
170 }
7b272fd7
C
171}
172
c30745f3
C
173@mixin peertube-button {
174 border: none;
c30745f3
C
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;
c30745f3
C
181 padding: 0 17px 0 13px;
182 cursor: pointer;
183}
184
185@mixin peertube-button-link {
186 display: inline-block;
187
c30745f3 188 @include disable-default-a-behaviour;
ce0e281d 189 @include peertube-button;
c30745f3 190}
2295ce6c 191
aa0f1963
RK
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
457bb213
C
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
c5911fd3
C
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
0727cab0
C
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}
4cc66133 245
3caf77d3
C
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
15a7387d
C
260@mixin peertube-select-container ($width) {
261 padding: 0;
262 margin: 0;
4cc66133 263 border: 1px solid #C6C6C6;
4cc66133
C
264 width: $width;
265 border-radius: 3px;
15a7387d 266 overflow: hidden;
14aa8556 267 background: var(--inputBackgroundColor);
15a7387d 268 position: relative;
5f0805d3 269 font-size: 15px;
15a7387d 270
2f4c784a
C
271 &.disabled {
272 background-color: #E5E5E5;
273
274 select {
275 cursor: default;
276 }
277 }
278
2c3abc4f
C
279 @media screen and (max-width: $width) {
280 width: 100%;
281 }
282
15a7387d 283 &:after {
3caf77d3 284 @include select-arrow-down;
15a7387d
C
285 }
286
287 select {
108af661 288 padding: 0 35px 0 12px;
15a7387d
C
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;
108af661 298 text-overflow: ellipsis;
8b183196 299 color: var(--mainForegroundColor);
15a7387d
C
300
301 &:focus {
302 outline: none;
303 }
304
305 &:-moz-focusring {
306 color: transparent;
307 text-shadow: 0 0 0 #000;
308 }
aa879092
C
309
310 option {
311 color: #000;
312 }
15a7387d
C
313 }
314}
315
5f0805d3
C
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
a0d69908 354@mixin peertube-checkbox ($border-width) {
1d5342ab 355 opacity: 0;
776ca9b1 356 position: absolute;
1d5342ab
C
357
358 &:focus + span {
46db9430 359 box-shadow: 0 0 0 .1rem rgba(87, 85, 217, .2);
1d5342ab 360 }
a0d69908 361
0f7fedc3 362 & + span {
a0d69908
C
363 position: relative;
364 width: 18px;
bc20aaed 365 min-width: 18px;
a0d69908 366 height: 18px;
18c97728 367 border: $border-width solid $fg-color;
a0d69908
C
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);
18c97728
C
381 border-right: 2px solid $bg-color;
382 border-bottom: 2px solid $bg-color;
a0d69908
C
383 }
384 }
385
0f7fedc3 386 &:checked + span {
a0d69908 387 border-color: transparent;
18c97728 388 background: $orange-color;
a0d69908
C
389 animation: jelly 0.6s ease;
390
391 &:after {
392 opacity: 1;
393 transform: rotate(45deg) scale(1);
394 }
395 }
396
0f7fedc3 397 & + span + span {
a0d69908
C
398 font-size: 15px;
399 font-weight: $font-regular;
400 margin-left: 5px;
401 cursor: pointer;
6693df9d 402 display: inline;
a0d69908 403 }
bbe0f064 404
0f7fedc3
C
405 &[disabled] + span,
406 &[disabled] + span + span{
bbe0f064
C
407 opacity: 0.5;
408 cursor: default;
409 }
a0d69908
C
410}
411
4e8c8728
C
412
413@mixin avatar ($size) {
414 object-fit: cover;
a4f99a76 415 border-radius: 50%;
4e8c8728
C
416 width: $size;
417 height: $size;
6051946e 418 min-width: $size;
fc641ded 419 min-height: $size;
4e8c8728 420}
c6352f2c
C
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}
0626e7af
C
445
446@mixin in-content-small-title {
447 text-transform: uppercase;
9a0fc840 448 color: var(--mainColor);
0626e7af
C
449 font-weight: $font-bold;
450 font-size: 13px;
170726f5
C
451}
452
22a16e36
C
453@mixin actor-owner {
454 @include disable-default-a-behaviour;
455
22a16e36
C
456 font-size: 13px;
457 margin-top: 4px;
9a0fc840 458 color: var(--mainForegroundColor);
22a16e36
C
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
170726f5 473@mixin sub-menu-with-actor {
aa0f1963 474 height: max-content;
170726f5
C
475 display: flex;
476 flex-direction: column;
41d71344 477 align-items: flex-start;
170726f5
C
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
7de6afdf
C
495 .actor-names {
496 display: flex;
497 align-items: center;
9b8a7aa8 498 flex-wrap: wrap;
7de6afdf
C
499
500 .actor-display-name {
501 font-size: 23px;
502 font-weight: $font-bold;
9b8a7aa8 503 margin-right: 7px;
7de6afdf
C
504 }
505
506 .actor-name {
7de6afdf
C
507 position: relative;
508 top: 3px;
509 font-size: 14px;
22a16e36 510 color: $grey-actor-name;
7de6afdf 511 }
170726f5
C
512 }
513
9b8a7aa8
RK
514 .actor-lower {
515 grid-area: lower;
516 }
517
170726f5
C
518 .actor-followers {
519 font-size: 15px;
520 }
a4f99a76
C
521
522 .actor-owner {
22a16e36 523 @include actor-owner;
a4f99a76 524 }
170726f5
C
525 }
526 }
527
528 .links {
529 margin-top: 0;
de702865 530 margin-bottom: 15px;
170726f5
C
531
532 a {
533 margin-top: 0;
534 margin-bottom: 0;
b061c8ed
RK
535 text-transform: uppercase;
536 font-weight: 600;
9b8a7aa8
RK
537 font-size: 110%;
538
539 @media screen and (max-width: $mobile-view) {
540 font-size: 130%;
541 }
170726f5
C
542 }
543 }
08c1efbe
C
544}
545
457bb213 546@mixin create-button {
08c1efbe
C
547 @include peertube-button-link;
548 @include orange-button;
457bb213 549 @include button-with-icon(20px, 5px, -1px);
a4f99a76 550}
22a16e36
C
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;
22a16e36
C
562 align-items: center;
563 }
6aff854c 564}
c5a1ae50
C
565
566@mixin dropdown-with-icon-item {
bc584963 567 padding: 6px 15px;
c5a1ae50
C
568
569 my-global-icon {
bc584963
RK
570 width: 22px;
571 opacity: .7;
c5a1ae50
C
572
573 margin-right: 10px;
574 position: relative;
575 top: -2px;
576 }
577}