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