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