refactor to UI components

This commit is contained in:
2023-05-26 01:44:20 +02:00
parent 9ca0bba526
commit 87729c9c00
13 changed files with 112 additions and 36 deletions

View File

@@ -0,0 +1,35 @@
<script setup lang="ts">
interface Props {
modelValue?: any
color?: 'regular' | 'primary'
checked?: boolean
disabled?: boolean
}
const props = withDefaults(defineProps<Props>(), {
color: 'regular'
})
const emit = defineEmits<{
'update:modelValue': [value: any]
}>()
const styleClass = computed(() => {
const colorVariants = {
regular: '',
primary: 'dui-checkbox-primary'
}
const colorClass = colorVariants[props.color]
return [colorClass]
})
</script>
<template>
<input
type="checkbox"
class="dui-checkbox dui-checkbox-sm border-secondary"
:class="styleClass"
:checked="props.modelValue"
@change="emit('update:modelValue', ($event.target as HTMLInputElement).checked)"
:disabled="props.disabled"
/>
</template>