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