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