]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
Try to fix travis 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 {
f2fab901 60 path[fill="#000000"], g[fill="#000000"], rect[fill="#000000"], circle[fill="#000000"] {
457bb213
C
61 fill: $color;
62 }
63
f2fab901 64 path[stroke="#000000"], g[stroke="#000000"], rect[stroke="#000000"], circle[stroke="#000000"] {
457bb213
C
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 }
aa879092
C
264
265 option {
266 color: #000;
267 }
15a7387d
C
268 }
269}
270
271@mixin peertube-select-disabled-container ($width) {
272 @include peertube-select-container($width);
273
274 background-color: #E5E5E5;
275
276 select {
277 cursor: default;
278 }
4cc66133 279}
a0d69908 280
5f0805d3
C
281// Thanks: https://codepen.io/triss90/pen/XNEdRe/
282@mixin peertube-radio-container {
283 input[type="radio"] {
284 display: none;
285
286 & + label {
287 font-weight: $font-regular;
288 cursor: pointer;
289
290 &:before {
291 position: relative;
292 top: -2px;
293 content: '';
294 background: #fff;
295 border-radius: 100%;
296 border: 1px solid #000;
297 display: inline-block;
298 width: 15px;
299 height: 15px;
300 vertical-align: middle;
301 cursor: pointer;
302 text-align: center;
303 margin-right: 10px;
304 }
305 }
306
307 &:checked + label:before {
308 background-color: #000;
309 box-shadow: inset 0 0 0 4px #fff;
310 }
311
312 &:focus + label:before {
313 outline: none;
314 border-color: #000;
315 }
316 }
317}
318
a0d69908
C
319@mixin peertube-checkbox ($border-width) {
320 display: none;
321
0f7fedc3 322 & + span {
a0d69908
C
323 position: relative;
324 width: 18px;
325 height: 18px;
9a0fc840 326 border: $border-width solid var(--mainForegroundColor);
a0d69908
C
327 border-radius: 3px;
328 vertical-align: middle;
329 cursor: pointer;
330
331 &:after {
332 content: '';
333 position: absolute;
334 top: calc(2px - #{$border-width});
335 left: 5px;
336 width: 5px;
337 height: 12px;
338 opacity: 0;
339 transform: rotate(45deg) scale(0);
dcbc29d5
C
340 border-right: 2px solid var(--mainBackgroundColor);
341 border-bottom: 2px solid var(--mainBackgroundColor);
a0d69908
C
342 }
343 }
344
0f7fedc3 345 &:checked + span {
a0d69908 346 border-color: transparent;
9a0fc840 347 background: var(--mainColor);
a0d69908
C
348 animation: jelly 0.6s ease;
349
350 &:after {
351 opacity: 1;
352 transform: rotate(45deg) scale(1);
353 }
354 }
355
0f7fedc3 356 & + span + span {
a0d69908
C
357 font-size: 15px;
358 font-weight: $font-regular;
359 margin-left: 5px;
360 cursor: pointer;
6693df9d 361 display: inline;
a0d69908 362 }
bbe0f064 363
0f7fedc3
C
364 &[disabled] + span,
365 &[disabled] + span + span{
bbe0f064
C
366 opacity: 0.5;
367 cursor: default;
368 }
a0d69908
C
369}
370
4e8c8728
C
371
372@mixin avatar ($size) {
373 object-fit: cover;
a4f99a76 374 border-radius: 50%;
4e8c8728
C
375 width: $size;
376 height: $size;
377}
c6352f2c
C
378
379@mixin chevron ($size, $border-width) {
380 border-style: solid;
381 border-width: $border-width $border-width 0 0;
382 content: '';
383 display: inline-block;
384 transform: rotate(-45deg);
385 height: $size;
386 width: $size;
387}
388
389@mixin chevron-right ($size, $border-width) {
390 @include chevron($size, $border-width);
391
392 left: 0;
393 transform: rotate(45deg);
394}
395
396@mixin chevron-left ($size, $border-width) {
397 @include chevron($size, $border-width);
398
399 left: 0.25em;
400 transform: rotate(-135deg);
401}
0626e7af
C
402
403@mixin in-content-small-title {
404 text-transform: uppercase;
9a0fc840 405 color: var(--mainColor);
0626e7af
C
406 font-weight: $font-bold;
407 font-size: 13px;
170726f5
C
408}
409
22a16e36
C
410@mixin actor-owner {
411 @include disable-default-a-behaviour;
412
9a0fc840 413 display: inline-table;
22a16e36
C
414 font-size: 13px;
415 margin-top: 4px;
9a0fc840 416 color: var(--mainForegroundColor);
22a16e36
C
417
418 span:hover {
419 opacity: 0.8;
420 }
421
422 img {
423 @include avatar(18px);
424
425 margin-left: 7px;
426 position: relative;
427 top: -2px;
428 }
429}
430
170726f5
C
431@mixin sub-menu-with-actor {
432 height: 160px;
433 display: flex;
434 flex-direction: column;
435 align-items: start;
436
437 .actor {
438 display: flex;
439 margin-top: 20px;
440 margin-bottom: 20px;
441
442 img {
443 @include avatar(80px);
444
445 margin-right: 20px;
446 }
447
448 .actor-info {
449 display: flex;
450 flex-direction: column;
451 justify-content: center;
452
7de6afdf
C
453 .actor-names {
454 display: flex;
455 align-items: center;
456
457 .actor-display-name {
458 font-size: 23px;
459 font-weight: $font-bold;
460 }
461
462 .actor-name {
463 margin-left: 7px;
464 position: relative;
465 top: 3px;
466 font-size: 14px;
22a16e36 467 color: $grey-actor-name;
7de6afdf 468 }
170726f5
C
469 }
470
471 .actor-followers {
472 font-size: 15px;
473 }
a4f99a76
C
474
475 .actor-owner {
22a16e36 476 @include actor-owner;
a4f99a76 477 }
170726f5
C
478 }
479 }
480
481 .links {
482 margin-top: 0;
483 margin-bottom: 10px;
484
485 a {
486 margin-top: 0;
487 margin-bottom: 0;
488 }
489 }
08c1efbe
C
490}
491
457bb213 492@mixin create-button {
08c1efbe
C
493 @include peertube-button-link;
494 @include orange-button;
457bb213 495 @include button-with-icon(20px, 5px, -1px);
a4f99a76 496}
22a16e36
C
497
498@mixin row-blocks {
499 display: flex;
500 min-height: 130px;
501 padding-bottom: 20px;
502 margin-bottom: 20px;
503 border-bottom: 1px solid #C6C6C6;
504
505 @media screen and (max-width: 800px) {
506 flex-direction: column;
507 height: auto;
508 text-align: center;
509 align-items: center;
510 }
6aff854c
C
511}
512
513@mixin video-miniature-small-screen {
514 text-align: center;
515
516 /deep/ .video-miniature {
517 padding-right: 0;
518 height: auto;
519 width: 100%;
520 margin-bottom: 20px;
521
522 .video-miniature-information {
523 width: 100% !important;
524
525 span {
526 width: 100%;
527 }
528 }
529
530 .video-thumbnail {
531 width: 100%;
532 height: auto;
533
534 img {
535 width: 100%;
536 height: auto;
537 }
538 }
539 }
650e3d5c 540}