]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
Fix toast close icon
[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
54e78847
RK
153@mixin tertiary-button {
154 color: $grey-foreground-color;
155 background-color: transparent;
156
157 &[disabled], &.disabled {
158 cursor: default;
159 }
160
161 my-global-icon {
162 @include apply-svg-color(transparent)
163 }
164}
165
7b272fd7 166@mixin grey-button {
15a7387d 167 &, &:active, &:focus {
457bb213
C
168 background-color: $grey-background-color;
169 color: $grey-foreground-color;
15a7387d 170 }
7b272fd7 171
4cc66133 172 &:hover, &:active, &:focus, &[disabled], &.disabled {
457bb213
C
173 color: $grey-foreground-color;
174 background-color: $grey-background-hover-color;
7b272fd7 175 }
4cc66133
C
176
177 &[disabled], &.disabled {
178 cursor: default;
179 }
457bb213
C
180
181 my-global-icon {
182 @include apply-svg-color($grey-foreground-color)
183 }
7b272fd7
C
184}
185
c30745f3
C
186@mixin peertube-button {
187 border: none;
c30745f3
C
188 font-weight: $font-semibold;
189 font-size: 15px;
190 height: $button-height;
191 line-height: $button-height;
192 border-radius: 3px;
193 text-align: center;
c30745f3
C
194 padding: 0 17px 0 13px;
195 cursor: pointer;
196}
197
198@mixin peertube-button-link {
199 display: inline-block;
200
c30745f3 201 @include disable-default-a-behaviour;
ce0e281d 202 @include peertube-button;
c30745f3 203}
2295ce6c 204
aa0f1963
RK
205@mixin peertube-button-outline {
206 display: inline-block;
207
208 @include disable-default-a-behaviour;
209 @include peertube-button;
210
211 border: 1px solid;
212}
213
457bb213
C
214@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) {
215 my-global-icon {
216 position: relative;
217 width: $width;
218 margin-right: $margin-right;
219 top: $top;
220 }
221}
222
c5911fd3
C
223@mixin peertube-button-file ($width) {
224 position: relative;
225 overflow: hidden;
226 display: inline-block;
227 width: $width;
228
229 @include peertube-button;
230 @include orange-button;
231
232 input[type=file] {
233 position: absolute;
234 top: 0;
235 right: 0;
236 min-width: 100%;
237 min-height: 100%;
238 font-size: 100px;
239 text-align: right;
240 filter: alpha(opacity=0);
241 opacity: 0;
242 outline: none;
243 background: white;
244 cursor: inherit;
245 display: block;
246 }
247}
248
0727cab0
C
249@mixin icon ($size) {
250 display: inline-block;
251 background-repeat: no-repeat;
252 background-size: contain;
253 width: $size;
254 height: $size;
255 vertical-align: middle;
256 cursor: pointer;
257}
4cc66133 258
3caf77d3
C
259@mixin select-arrow-down {
260 top: 50%;
261 right: calc(0% + 15px);
262 content: " ";
263 height: 0;
264 width: 0;
265 position: absolute;
266 pointer-events: none;
267 border: 5px solid rgba(0, 0, 0, 0);
268 border-top-color: #000;
269 margin-top: -2px;
270 z-index: 100;
271}
272
15a7387d
C
273@mixin peertube-select-container ($width) {
274 padding: 0;
275 margin: 0;
4cc66133 276 border: 1px solid #C6C6C6;
4cc66133
C
277 width: $width;
278 border-radius: 3px;
15a7387d 279 overflow: hidden;
14aa8556 280 background: var(--inputBackgroundColor);
15a7387d 281 position: relative;
5f0805d3 282 font-size: 15px;
15a7387d 283
2f4c784a
C
284 &.disabled {
285 background-color: #E5E5E5;
286
287 select {
288 cursor: default;
289 }
290 }
291
2c3abc4f
C
292 @media screen and (max-width: $width) {
293 width: 100%;
294 }
295
15a7387d 296 &:after {
3caf77d3 297 @include select-arrow-down;
15a7387d
C
298 }
299
300 select {
108af661 301 padding: 0 35px 0 12px;
15a7387d
C
302 width: calc(100% + 2px);
303 position: relative;
304 left: 1px;
305 border: none;
306 box-shadow: none;
307 background: transparent none;
308 appearance: none;
309 cursor: pointer;
310 height: $button-height;
108af661 311 text-overflow: ellipsis;
8b183196 312 color: var(--mainForegroundColor);
15a7387d
C
313
314 &:focus {
315 outline: none;
316 }
317
318 &:-moz-focusring {
319 color: transparent;
320 text-shadow: 0 0 0 #000;
321 }
aa879092
C
322
323 option {
324 color: #000;
325 }
15a7387d
C
326 }
327}
328
5f0805d3
C
329// Thanks: https://codepen.io/triss90/pen/XNEdRe/
330@mixin peertube-radio-container {
331 input[type="radio"] {
332 display: none;
333
334 & + label {
335 font-weight: $font-regular;
336 cursor: pointer;
337
338 &:before {
339 position: relative;
340 top: -2px;
341 content: '';
342 background: #fff;
343 border-radius: 100%;
344 border: 1px solid #000;
345 display: inline-block;
346 width: 15px;
347 height: 15px;
348 vertical-align: middle;
349 cursor: pointer;
350 text-align: center;
351 margin-right: 10px;
352 }
353 }
354
355 &:checked + label:before {
356 background-color: #000;
357 box-shadow: inset 0 0 0 4px #fff;
358 }
359
360 &:focus + label:before {
361 outline: none;
362 border-color: #000;
363 }
364 }
365}
366
a0d69908 367@mixin peertube-checkbox ($border-width) {
1d5342ab 368 opacity: 0;
776ca9b1 369 position: absolute;
1d5342ab
C
370
371 &:focus + span {
46db9430 372 box-shadow: 0 0 0 .1rem rgba(87, 85, 217, .2);
1d5342ab 373 }
a0d69908 374
0f7fedc3 375 & + span {
a0d69908
C
376 position: relative;
377 width: 18px;
bc20aaed 378 min-width: 18px;
a0d69908 379 height: 18px;
18c97728 380 border: $border-width solid $fg-color;
a0d69908
C
381 border-radius: 3px;
382 vertical-align: middle;
383 cursor: pointer;
384
385 &:after {
386 content: '';
387 position: absolute;
388 top: calc(2px - #{$border-width});
389 left: 5px;
390 width: 5px;
391 height: 12px;
392 opacity: 0;
393 transform: rotate(45deg) scale(0);
18c97728
C
394 border-right: 2px solid $bg-color;
395 border-bottom: 2px solid $bg-color;
a0d69908
C
396 }
397 }
398
0f7fedc3 399 &:checked + span {
a0d69908 400 border-color: transparent;
18c97728 401 background: $orange-color;
a0d69908
C
402 animation: jelly 0.6s ease;
403
404 &:after {
405 opacity: 1;
406 transform: rotate(45deg) scale(1);
407 }
408 }
409
0f7fedc3 410 & + span + span {
a0d69908
C
411 font-size: 15px;
412 font-weight: $font-regular;
413 margin-left: 5px;
414 cursor: pointer;
6693df9d 415 display: inline;
a0d69908 416 }
bbe0f064 417
0f7fedc3
C
418 &[disabled] + span,
419 &[disabled] + span + span{
bbe0f064
C
420 opacity: 0.5;
421 cursor: default;
422 }
a0d69908
C
423}
424
4e8c8728
C
425
426@mixin avatar ($size) {
427 object-fit: cover;
a4f99a76 428 border-radius: 50%;
4e8c8728
C
429 width: $size;
430 height: $size;
6051946e 431 min-width: $size;
fc641ded 432 min-height: $size;
4e8c8728 433}
c6352f2c
C
434
435@mixin chevron ($size, $border-width) {
436 border-style: solid;
437 border-width: $border-width $border-width 0 0;
438 content: '';
439 display: inline-block;
440 transform: rotate(-45deg);
441 height: $size;
442 width: $size;
443}
444
445@mixin chevron-right ($size, $border-width) {
446 @include chevron($size, $border-width);
447
448 left: 0;
449 transform: rotate(45deg);
450}
451
452@mixin chevron-left ($size, $border-width) {
453 @include chevron($size, $border-width);
454
455 left: 0.25em;
456 transform: rotate(-135deg);
457}
0626e7af
C
458
459@mixin in-content-small-title {
460 text-transform: uppercase;
9a0fc840 461 color: var(--mainColor);
0626e7af
C
462 font-weight: $font-bold;
463 font-size: 13px;
170726f5
C
464}
465
482fa503
RK
466@mixin settings-big-title {
467 text-transform: uppercase;
468 color: var(--mainColor);
469 font-weight: $font-bold;
470 font-size: 110%;
471 margin-bottom: 10px;
472}
473
22a16e36
C
474@mixin actor-owner {
475 @include disable-default-a-behaviour;
476
22a16e36
C
477 font-size: 13px;
478 margin-top: 4px;
9a0fc840 479 color: var(--mainForegroundColor);
22a16e36
C
480
481 span:hover {
482 opacity: 0.8;
483 }
484
485 img {
486 @include avatar(18px);
487
488 margin-left: 7px;
489 position: relative;
490 top: -2px;
491 }
492}
493
170726f5 494@mixin sub-menu-with-actor {
aa0f1963 495 height: max-content;
170726f5
C
496 display: flex;
497 flex-direction: column;
41d71344 498 align-items: flex-start;
170726f5
C
499
500 .actor {
501 display: flex;
502 margin-top: 20px;
503 margin-bottom: 20px;
504
505 img {
506 @include avatar(80px);
507
508 margin-right: 20px;
509 }
510
511 .actor-info {
512 display: flex;
513 flex-direction: column;
514 justify-content: center;
515
7de6afdf
C
516 .actor-names {
517 display: flex;
518 align-items: center;
9b8a7aa8 519 flex-wrap: wrap;
7de6afdf
C
520
521 .actor-display-name {
522 font-size: 23px;
523 font-weight: $font-bold;
9b8a7aa8 524 margin-right: 7px;
7de6afdf
C
525 }
526
527 .actor-name {
7de6afdf
C
528 position: relative;
529 top: 3px;
530 font-size: 14px;
22a16e36 531 color: $grey-actor-name;
7de6afdf 532 }
170726f5
C
533 }
534
9b8a7aa8
RK
535 .actor-lower {
536 grid-area: lower;
537 }
538
170726f5
C
539 .actor-followers {
540 font-size: 15px;
541 }
a4f99a76
C
542
543 .actor-owner {
22a16e36 544 @include actor-owner;
a4f99a76 545 }
170726f5
C
546 }
547 }
548
549 .links {
550 margin-top: 0;
de702865 551 margin-bottom: 15px;
170726f5
C
552
553 a {
554 margin-top: 0;
555 margin-bottom: 0;
b061c8ed
RK
556 text-transform: uppercase;
557 font-weight: 600;
9b8a7aa8
RK
558 font-size: 110%;
559
560 @media screen and (max-width: $mobile-view) {
561 font-size: 130%;
562 }
170726f5
C
563 }
564 }
08c1efbe
C
565}
566
457bb213 567@mixin create-button {
08c1efbe
C
568 @include peertube-button-link;
569 @include orange-button;
457bb213 570 @include button-with-icon(20px, 5px, -1px);
a4f99a76 571}
22a16e36
C
572
573@mixin row-blocks {
574 display: flex;
575 min-height: 130px;
576 padding-bottom: 20px;
577 margin-bottom: 20px;
578 border-bottom: 1px solid #C6C6C6;
579
580 @media screen and (max-width: 800px) {
581 flex-direction: column;
582 height: auto;
22a16e36
C
583 align-items: center;
584 }
6aff854c 585}
c5a1ae50
C
586
587@mixin dropdown-with-icon-item {
bc584963 588 padding: 6px 15px;
c5a1ae50
C
589
590 my-global-icon {
bc584963
RK
591 width: 22px;
592 opacity: .7;
c5a1ae50
C
593
594 margin-right: 10px;
595 position: relative;
596 top: -2px;
597 }
598}