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