-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntervalEditBox.vue
More file actions
66 lines (62 loc) · 1.77 KB
/
IntervalEditBox.vue
File metadata and controls
66 lines (62 loc) · 1.77 KB
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
<script setup lang="ts">
import { string } from 'vue-types';
import BaseIcon from '@/components/BaseIcon.vue';
import BaseControl from '@/components/BaseControl.vue';
import LayoutInline from '@/components/LayoutInline.vue';
import { minutesToMs, getMinutes } from '@/utils';
import { IntervalType } from '@/types';
const type = defineModel<IntervalType>('type', {
default: IntervalType.None,
});
const duration = defineModel<number>('duration', {
get: getMinutes,
set: minutesToMs,
default: 0,
});
defineProps({
id: string().isRequired,
});
defineEmits<{
delete: [id?: string];
}>();
</script>
<template>
<fieldset class="w-full min-w-0">
<legend class="sr-only">Interval Settings</legend>
<LayoutInline vertical-align="center">
<label class="grid-overlap grid grow items-center">
<select v-model="type" class="input min-w-0 truncate">
<template v-for="(value, name) in IntervalType" :key="value">
<option
v-if="value !== IntervalType.None"
:value="value"
:selected="value === type"
>
{{ name }}
</option></template
>
</select>
<BaseIcon
name="cheveron-down"
class="pointer-events-none ms-auto me-1"
/>
<span class="sr-only">Type</span>
</label>
<label class="flex items-center gap-1">
<input
v-model.number="duration"
class="input"
type="number"
min="1"
max="60"
:size="5"
/>
<span class="sr-only">Duration</span>
<span class="text-sm">mins</span>
</label>
<BaseControl icon="trash" @click="$emit('delete', id)">
Delete
</BaseControl>
</LayoutInline>
</fieldset>
</template>