refactor: ReadOnlyAlertItem typing

This commit is contained in:
axolotle 2024-07-05 20:52:03 +02:00
parent cc90c50baf
commit b9cf8b92fe
2 changed files with 15 additions and 9 deletions

View file

@ -1,12 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue' import { computed } from 'vue'
const props = defineProps<{ import type { ReadOnlyAlertItemProps } from '@/types/form'
label: string
id?: string const props = withDefaults(defineProps<ReadOnlyAlertItemProps>(), {
type?: 'success' | 'info' | 'warning' | 'danger' id: undefined,
icon?: string icon: undefined,
}>() type: 'success',
})
const icon = computed(() => { const icon = computed(() => {
const icons = { const icons = {
@ -22,11 +23,12 @@ const icon = computed(() => {
<template> <template>
<BAlert <BAlert
class="d-flex flex-column flex-md-row align-items-center" :id="id"
:model-value="true"
:variant="type" :variant="type"
:modelValue="true" class="d-flex flex-column flex-md-row align-items-center"
> >
<YIcon :iname="icon" class="me-md-3 mb-md-0 mb-2" :variant="type" /> <YIcon :iname="icon" :variant="type" class="me-md-3 mb-md-0 mb-2" />
<VueShowdown :markdown="label" tag="span" class="markdown" /> <VueShowdown :markdown="label" tag="span" class="markdown" />
</BAlert> </BAlert>

View file

@ -19,6 +19,10 @@ export type DisplayTextItemProps = BaseDisplayItemProps
export type MarkdownItemProps = BaseDisplayItemProps export type MarkdownItemProps = BaseDisplayItemProps
export type ReadOnlyAlertItemProps = BaseDisplayItemProps & {
icon?: string
type?: StateVariant
}
// WRITABLE // WRITABLE