feat: improve message types
This commit is contained in:
parent
baaf612239
commit
4c5bb3f114
@ -10,29 +10,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {computed, type PropType} from 'vue'
|
import {computed} from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = withDefaults(defineProps<{
|
||||||
variant: {
|
variant?: 'info' | 'danger' | 'warning' | 'success',
|
||||||
type: String,
|
textAlign?: TextAlignVariant
|
||||||
default: 'info',
|
}>(), {
|
||||||
},
|
variant: 'info',
|
||||||
textAlign: {
|
textAlign: 'left',
|
||||||
type: String as PropType<textAlignVariants>,
|
|
||||||
default: 'left',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const TEXT_ALIGN_MAP = Object.freeze({
|
const TEXT_ALIGN_MAP = {
|
||||||
left: '',
|
left: '',
|
||||||
center: 'has-text-centered',
|
center: 'has-text-centered',
|
||||||
right: 'has-text-right',
|
right: 'has-text-right',
|
||||||
})
|
} as const
|
||||||
|
|
||||||
type textAlignVariants = keyof typeof TEXT_ALIGN_MAP
|
export type TextAlignVariant = keyof typeof TEXT_ALIGN_MAP
|
||||||
|
|
||||||
const textAlignClass = computed(() => TEXT_ALIGN_MAP[props.textAlign])
|
const textAlignClass = computed(() => TEXT_ALIGN_MAP[props.textAlign])
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user