fix: propType validation in message.vue
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Dominik Pschenitschni 2021-12-21 16:07:38 +01:00
parent 27cd9535bf
commit 9a3069c20d
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
1 changed files with 11 additions and 12 deletions

View File

@ -7,7 +7,15 @@
</template>
<script lang="ts" setup>
import {computed} from 'vue'
import {computed, PropType} from 'vue'
const TEXT_ALIGN_MAP = Object.freeze({
left: '',
center: 'has-text-centered',
right: 'has-text-right',
})
type textAlignVariants = keyof typeof TEXT_ALIGN_MAP
const props = defineProps({
variant: {
@ -15,21 +23,12 @@ const props = defineProps({
default: 'info',
},
textAlign: {
type: String,
type: String as PropType<textAlignVariants>,
default: 'left',
},
})
const textAlignClass = computed(() => {
switch (props.textAlign) {
case 'left':
return ''
case 'right':
return 'has-text-right'
case 'center':
return 'has-text-centered'
}
})
const textAlignClass = computed(() => TEXT_ALIGN_MAP[props.textAlign])
</script>