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