Skip to content

Commit

Permalink
fix(alert): make props reactive (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flambe authored Jan 8, 2025
1 parent 223478e commit 8810269
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/FwbAlert/FwbAlert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</div>
</template>
<script lang="ts" setup>
import { ref, useAttrs } from 'vue'
import { computed, ref, useAttrs } from 'vue'
import { twMerge } from 'tailwind-merge'
import type { AlertType } from './types'
Expand Down Expand Up @@ -112,7 +112,7 @@ const closeButtonClasses: Record<AlertType, string> = {
success: 'text-green-500 dark:text-green-400 bg-green-50 hover:bg-green-200 focus:ring-green-400',
warning: 'text-yellow-500 dark:text-yellow-300 bg-yellow-50 hover:bg-yellow-200 focus:ring-yellow-400',
}
const closeBtnClasses = twMerge(defaultCloseButtonClasses, closeButtonClasses[props.type])
const closeBtnClasses = computed(() => twMerge(defaultCloseButtonClasses, closeButtonClasses[props.type]))
const borderColor: Record<AlertType, string> = {
danger: 'border-red-500 dark:text-red-400',
dark: 'border-gray-500 dark:text-gray-400',
Expand All @@ -127,14 +127,14 @@ const colors = {
success: [alertTextClasses.success, alertTypeClasses.success].join(' '),
warning: [alertTextClasses.warning, alertTypeClasses.warning].join(' '),
}
const wrapperClasses = twMerge(
const wrapperClasses = computed(() => twMerge(
'p-4 gap-3 text-sm dark:bg-gray-800 rounded-lg',
colors[props.type],
(props.icon || props.closable) && 'flex items-center',
borderColor[props.type],
props.border && 'border',
attrs.class as string,
)
))
const visible = ref(true)
function onCloseClick () {
Expand Down

0 comments on commit 8810269

Please sign in to comment.