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