-
Notifications
You must be signed in to change notification settings - Fork 0
/
TimeInput.vue
90 lines (77 loc) · 1.58 KB
/
TimeInput.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<template>
<div class="time-input">
<input
class="border text-2xl px-4 py-2 leading-none rounded w-full"
type="text"
ref="input"
:aria-invalid="invalid"
:value="value"
:class="{
'is-invalid': invalid
}"
@input="$emit('input', $event.target.value)"
/>
<div
class="text-sm mt-1"
:class="[invalid ? 'text-red-500' : 'theme:text-secondary']"
>
<span v-if="invalid">Time invalid. </span>
Enter time in
<span class="font-semibold">hour:minute:second</span>
format.
</div>
</div>
</template>
<script>
export default {
name: "TimeInput",
props: {
value: String,
invalid: Boolean
},
methods: {
focus() {
this.$refs.input.focus();
}
}
};
</script>
<style lang="scss">
.color-scheme-dark .time-input {
input {
background-color: rgba(0, 0, 0, 0.15);
@apply text-white border-gray-800;
&:hover {
@apply border-gray-700;
}
&:focus {
box-shadow: #4fc3f7 0px 0px 0px 3px;
}
&:focus.is-invalid {
box-shadow: #f06292 0px 0px 0px 3px !important;
}
&.is-invalid {
@apply border-red-500;
}
}
}
.color-scheme-light .time-input {
input {
background-color: rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.87);
@apply border-gray-300;
&:hover {
@apply border-gray-400;
}
&:focus {
box-shadow: #4fc3f7 0px 0px 0px 3px;
}
&:focus.is-invalid {
box-shadow: #f06292 0px 0px 0px 3px !important;
}
&.is-invalid {
@apply border-red-500;
}
}
}
</style>