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