]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/sass/include/_mixins.scss
Update a little bit user dropdown message
[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
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;
2a53942d 102 min-height: $button-height;
8a19bee1
C
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
aa0f1963
RK
182@mixin peertube-button-outline {
183 display: inline-block;
184
185 @include disable-default-a-behaviour;
186 @include peertube-button;
187
188 border: 1px solid;
189}
190
457bb213
C
191@mixin button-with-icon($width: 20px, $margin-right: 3px, $top: -1px) {
192 my-global-icon {
193 position: relative;
194 width: $width;
195 margin-right: $margin-right;
196 top: $top;
197 }
198}
199
c5911fd3
C
200@mixin peertube-button-file ($width) {
201 position: relative;
202 overflow: hidden;
203 display: inline-block;
204 width: $width;
205
206 @include peertube-button;
207 @include orange-button;
208
209 input[type=file] {
210 position: absolute;
211 top: 0;
212 right: 0;
213 min-width: 100%;
214 min-height: 100%;
215 font-size: 100px;
216 text-align: right;
217 filter: alpha(opacity=0);
218 opacity: 0;
219 outline: none;
220 background: white;
221 cursor: inherit;
222 display: block;
223 }
224}
225
0727cab0
C
226@mixin icon ($size) {
227 display: inline-block;
228 background-repeat: no-repeat;
229 background-size: contain;
230 width: $size;
231 height: $size;
232 vertical-align: middle;
233 cursor: pointer;
234}
4cc66133 235
3caf77d3
C
236@mixin select-arrow-down {
237 top: 50%;
238 right: calc(0% + 15px);
239 content: " ";
240 height: 0;
241 width: 0;
242 position: absolute;
243 pointer-events: none;
244 border: 5px solid rgba(0, 0, 0, 0);
245 border-top-color: #000;
246 margin-top: -2px;
247 z-index: 100;
248}
249
15a7387d
C
250@mixin peertube-select-container ($width) {
251 padding: 0;
252 margin: 0;
4cc66133 253 border: 1px solid #C6C6C6;
4cc66133
C
254 width: $width;
255 border-radius: 3px;
15a7387d 256 overflow: hidden;
9a0fc840 257 background: var(--inputColor);
15a7387d 258 position: relative;
5f0805d3 259 font-size: 15px;
15a7387d 260
2f4c784a
C
261 &.disabled {
262 background-color: #E5E5E5;
263
264 select {
265 cursor: default;
266 }
267 }
268
2c3abc4f
C
269 @media screen and (max-width: $width) {
270 width: 100%;
271 }
272
15a7387d 273 &:after {
3caf77d3 274 @include select-arrow-down;
15a7387d
C
275 }
276
277 select {
108af661 278 padding: 0 35px 0 12px;
15a7387d
C
279 width: calc(100% + 2px);
280 position: relative;
281 left: 1px;
282 border: none;
283 box-shadow: none;
284 background: transparent none;
285 appearance: none;
286 cursor: pointer;
287 height: $button-height;
108af661 288 text-overflow: ellipsis;
8b183196 289 color: var(--mainForegroundColor);
15a7387d
C
290
291 &:focus {
292 outline: none;
293 }
294
295 &:-moz-focusring {
296 color: transparent;
297 text-shadow: 0 0 0 #000;
298 }
aa879092
C
299
300 option {
301 color: #000;
302 }
15a7387d
C
303 }
304}
305
5f0805d3
C
306// Thanks: https://codepen.io/triss90/pen/XNEdRe/
307@mixin peertube-radio-container {
308 input[type="radio"] {
309 display: none;
310
311 & + label {
312 font-weight: $font-regular;
313 cursor: pointer;
314
315 &:before {
316 position: relative;
317 top: -2px;
318 content: '';
319 background: #fff;
320 border-radius: 100%;
321 border: 1px solid #000;
322 display: inline-block;
323 width: 15px;
324 height: 15px;
325 vertical-align: middle;
326 cursor: pointer;
327 text-align: center;
328 margin-right: 10px;
329 }
330 }
331
332 &:checked + label:before {
333 background-color: #000;
334 box-shadow: inset 0 0 0 4px #fff;
335 }
336
337 &:focus + label:before {
338 outline: none;
339 border-color: #000;
340 }
341 }
342}
343
a0d69908 344@mixin peertube-checkbox ($border-width) {
1d5342ab 345 opacity: 0;
776ca9b1 346 position: absolute;
1d5342ab
C
347
348 &:focus + span {
46db9430 349 box-shadow: 0 0 0 .1rem rgba(87, 85, 217, .2);
1d5342ab 350 }
a0d69908 351
0f7fedc3 352 & + span {
a0d69908
C
353 position: relative;
354 width: 18px;
bc20aaed 355 min-width: 18px;
a0d69908 356 height: 18px;
18c97728 357 border: $border-width solid $fg-color;
a0d69908
C
358 border-radius: 3px;
359 vertical-align: middle;
360 cursor: pointer;
361
362 &:after {
363 content: '';
364 position: absolute;
365 top: calc(2px - #{$border-width});
366 left: 5px;
367 width: 5px;
368 height: 12px;
369 opacity: 0;
370 transform: rotate(45deg) scale(0);
18c97728
C
371 border-right: 2px solid $bg-color;
372 border-bottom: 2px solid $bg-color;
a0d69908
C
373 }
374 }
375
0f7fedc3 376 &:checked + span {
a0d69908 377 border-color: transparent;
18c97728 378 background: $orange-color;
a0d69908
C
379 animation: jelly 0.6s ease;
380
381 &:after {
382 opacity: 1;
383 transform: rotate(45deg) scale(1);
384 }
385 }
386
0f7fedc3 387 & + span + span {
a0d69908
C
388 font-size: 15px;
389 font-weight: $font-regular;
390 margin-left: 5px;
391 cursor: pointer;
6693df9d 392 display: inline;
a0d69908 393 }
bbe0f064 394
0f7fedc3
C
395 &[disabled] + span,
396 &[disabled] + span + span{
bbe0f064
C
397 opacity: 0.5;
398 cursor: default;
399 }
a0d69908
C
400}
401
4e8c8728
C
402
403@mixin avatar ($size) {
404 object-fit: cover;
a4f99a76 405 border-radius: 50%;
4e8c8728
C
406 width: $size;
407 height: $size;
6051946e 408 min-width: $size;
fc641ded 409 min-height: $size;
4e8c8728 410}
c6352f2c
C
411
412@mixin chevron ($size, $border-width) {
413 border-style: solid;
414 border-width: $border-width $border-width 0 0;
415 content: '';
416 display: inline-block;
417 transform: rotate(-45deg);
418 height: $size;
419 width: $size;
420}
421
422@mixin chevron-right ($size, $border-width) {
423 @include chevron($size, $border-width);
424
425 left: 0;
426 transform: rotate(45deg);
427}
428
429@mixin chevron-left ($size, $border-width) {
430 @include chevron($size, $border-width);
431
432 left: 0.25em;
433 transform: rotate(-135deg);
434}
0626e7af
C
435
436@mixin in-content-small-title {
437 text-transform: uppercase;
9a0fc840 438 color: var(--mainColor);
0626e7af
C
439 font-weight: $font-bold;
440 font-size: 13px;
170726f5
C
441}
442
22a16e36
C
443@mixin actor-owner {
444 @include disable-default-a-behaviour;
445
9a0fc840 446 display: inline-table;
22a16e36
C
447 font-size: 13px;
448 margin-top: 4px;
9a0fc840 449 color: var(--mainForegroundColor);
22a16e36
C
450
451 span:hover {
452 opacity: 0.8;
453 }
454
455 img {
456 @include avatar(18px);
457
458 margin-left: 7px;
459 position: relative;
460 top: -2px;
461 }
462}
463
170726f5 464@mixin sub-menu-with-actor {
aa0f1963 465 height: max-content;
170726f5
C
466 display: flex;
467 flex-direction: column;
41d71344 468 align-items: flex-start;
170726f5
C
469
470 .actor {
471 display: flex;
472 margin-top: 20px;
473 margin-bottom: 20px;
474
475 img {
476 @include avatar(80px);
477
478 margin-right: 20px;
479 }
480
481 .actor-info {
482 display: flex;
483 flex-direction: column;
484 justify-content: center;
485
7de6afdf
C
486 .actor-names {
487 display: flex;
488 align-items: center;
489
490 .actor-display-name {
491 font-size: 23px;
492 font-weight: $font-bold;
493 }
494
495 .actor-name {
496 margin-left: 7px;
497 position: relative;
498 top: 3px;
499 font-size: 14px;
22a16e36 500 color: $grey-actor-name;
7de6afdf 501 }
170726f5
C
502 }
503
504 .actor-followers {
505 font-size: 15px;
506 }
a4f99a76
C
507
508 .actor-owner {
22a16e36 509 @include actor-owner;
a4f99a76 510 }
170726f5
C
511 }
512 }
513
514 .links {
515 margin-top: 0;
516 margin-bottom: 10px;
517
518 a {
519 margin-top: 0;
520 margin-bottom: 0;
b061c8ed
RK
521 text-transform: uppercase;
522 font-weight: 600;
170726f5
C
523 }
524 }
08c1efbe
C
525}
526
457bb213 527@mixin create-button {
08c1efbe
C
528 @include peertube-button-link;
529 @include orange-button;
457bb213 530 @include button-with-icon(20px, 5px, -1px);
a4f99a76 531}
22a16e36
C
532
533@mixin row-blocks {
534 display: flex;
535 min-height: 130px;
536 padding-bottom: 20px;
537 margin-bottom: 20px;
538 border-bottom: 1px solid #C6C6C6;
539
540 @media screen and (max-width: 800px) {
541 flex-direction: column;
542 height: auto;
22a16e36
C
543 align-items: center;
544 }
6aff854c 545}
c5a1ae50
C
546
547@mixin dropdown-with-icon-item {
bc584963 548 padding: 6px 15px;
c5a1ae50
C
549
550 my-global-icon {
bc584963
RK
551 width: 22px;
552 opacity: .7;
c5a1ae50
C
553
554 margin-right: 10px;
555 position: relative;
556 top: -2px;
557 }
558}