Skip to content

Commit eb37ccb

Browse files
committed
[Feature] Add loader bar
1 parent 694ac7a commit eb37ccb

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-input-ui",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "A beautiful input made with Vue JS",
55
"author": "Louis Mazel <mazuel.loic@gmail.com>",
66
"scripts": {

src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
hint="is required"
8181
:dark="darkMode"
8282
required
83+
loader
8384
/>
8485
<br>
8586
<VueInputUi
@@ -88,6 +89,7 @@
8889
:dark="darkMode"
8990
textarea
9091
rows="4"
92+
loader
9193
/>
9294
</div>
9395
</div>

src/VueInputUi/index.vue

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
>
5151
{{ hintValue || labelValue }}
5252
</label>
53+
<div
54+
v-if="loader"
55+
class="loader"
56+
/>
5357
</div>
5458
</template>
5559

@@ -71,7 +75,8 @@
7175
valid: { type: Boolean, default: false },
7276
validColor: { type: String, default: 'yellowgreen' },
7377
required: { type: Boolean, default: false },
74-
textarea: { type: Boolean, default: false }
78+
textarea: { type: Boolean, default: false },
79+
loader: { type: Boolean, default: false },
7580
},
7681
data: function () {
7782
return {
@@ -328,5 +333,51 @@
328333
}
329334
}
330335
}
336+
.loader {
337+
top: -2px;
338+
height: 2px;
339+
width: 100%;
340+
position: relative;
341+
overflow: hidden;
342+
border-radius: 2px;
343+
344+
&::before {
345+
display: block;
346+
position: absolute;
347+
content: '';
348+
left: -200px;
349+
width: 200px;
350+
height: 2px;
351+
background-color: rgba(black, 0.2);
352+
animation: loading 2s linear infinite;
353+
}
354+
}
355+
356+
@keyframes loading {
357+
from {
358+
left: -200px;
359+
width: 30%;
360+
}
361+
362+
50% {
363+
width: 30%;
364+
}
365+
366+
70% {
367+
width: 70%;
368+
}
369+
370+
80% {
371+
left: 50%;
372+
}
373+
374+
95% {
375+
left: 120%;
376+
}
377+
378+
to {
379+
left: 100%;
380+
}
381+
}
331382
}
332383
</style>

0 commit comments

Comments
 (0)