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