Skip to content

Commit 1926a05

Browse files
committed
feat: improve loader (use color input props)
1 parent ebb9678 commit 1926a05

File tree

2 files changed

+38
-25
lines changed

2 files changed

+38
-25
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Vue.component('vue-input-ui', VueInputUi);
5454
| v-model | String/Int | true | - | - |
5555
| id | String | false | VueInputUi | - |
5656
| label | String | false | Enter Text | - |
57-
| type | String | no | text | text or number |
57+
| type | String | no | text | [text|number|textarea] |
5858
| size | String `sm or lg` | no | false | |
5959
| color | String `HEX` | no | dogderblue | |
6060
| hint* | String | no | - | |
@@ -64,6 +64,7 @@ Vue.component('vue-input-ui', VueInputUi);
6464
| required | Boolean | no | false | |
6565
| readonly | Boolean | no | false | |
6666
| clearable | Boolean | no | false | |
67+
| loader | Boolean | no | false | |
6768

6869
## Contribution
6970

Diff for: src/VueInputUi/index.vue

+36-24
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@
7070
v-if="loader"
7171
class="loader"
7272
:class="{ textarea }"
73-
/>
73+
>
74+
<div
75+
class="loader__progress-bar"
76+
:style="[loaderProgressBarBg]"
77+
/>
78+
</div>
7479
</div>
7580
</template>
7681

@@ -114,6 +119,9 @@
114119
? { color: `${this.valid ? this.validColor : this.color}` }
115120
: null
116121
},
122+
loaderProgressBarBg () {
123+
return { backgroundColor: this.color }
124+
},
117125
inputValue: {
118126
get () {
119127
return this.value
@@ -163,6 +171,9 @@
163171
}
164172
.field.vue-input-ui {
165173
position: relative;
174+
border-radius: 4px;
175+
overflow: hidden;
176+
166177
&.is-dark {
167178
.field-label{
168179
color: rgba(white, 0.70);
@@ -327,6 +338,30 @@
327338
.lm-text-danger {
328339
color: orangered !important;
329340
}
341+
342+
.loader {
343+
top: -2px;
344+
height: 2px;
345+
width: 100%;
346+
position: relative;
347+
overflow: hidden;
348+
border-radius: 4px;
349+
350+
&.textarea {
351+
top: -7px;
352+
}
353+
354+
&__progress-bar {
355+
display: block;
356+
position: absolute;
357+
content: '';
358+
left: -200px;
359+
width: 200px;
360+
height: 2px;
361+
animation: loading 2s linear infinite;
362+
}
363+
}
364+
330365
&.is-dark {
331366
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
332367
color: rgba(white, 0.70);
@@ -413,29 +448,6 @@
413448
}
414449
}
415450
}
416-
.loader {
417-
top: -2px;
418-
height: 2px;
419-
width: 100%;
420-
position: relative;
421-
overflow: hidden;
422-
border-radius: 2px;
423-
424-
&.textarea {
425-
top: -7px;
426-
}
427-
428-
&::before {
429-
display: block;
430-
position: absolute;
431-
content: '';
432-
left: -200px;
433-
width: 200px;
434-
height: 2px;
435-
background-color: rgba(black, 0.2);
436-
animation: loading 2s linear infinite;
437-
}
438-
}
439451
440452
@keyframes loading {
441453
from {

0 commit comments

Comments
 (0)