Skip to content
This repository was archived by the owner on Sep 24, 2024. It is now read-only.

Commit 06f9e53

Browse files
SelemondevSelemondev
Selemondev
authored and
Selemondev
committed
fix(app): alert click prop type
This pull request is intended to fix the alert component click prop type to provide a more strict type to the click function that is passed as a prop.
1 parent a22d1b6 commit 06f9e53

File tree

1 file changed

+13
-5
lines changed
  • packages/nuxt-ui-vue/src/components/elements/Alert

1 file changed

+13
-5
lines changed

packages/nuxt-ui-vue/src/components/elements/Alert/UAlert.vue

+13-5
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ const props = defineProps({
3737
default: () => nuxtLabsTheme.UAlert.base.default.closeButton,
3838
},
3939
actions: {
40-
// eslint-disable-next-line @typescript-eslint/ban-types
41-
type: Array as PropType<(Button & { click: Function })[]>,
40+
type: Array as PropType<(Button & { click: () => void })[]>,
4241
default: () => [],
4342
},
4443
color: {
@@ -104,7 +103,10 @@ export default defineComponent({
104103

105104
<template>
106105
<div :class="alertClass">
107-
<div class="flex gap-3" :class="{ 'items-start': (description || $slots.description), 'items-center': !description && !$slots.description }">
106+
<div
107+
class="flex gap-3"
108+
:class="{ 'items-start': (description || $slots.description), 'items-center': !description && !$slots.description }"
109+
>
108110
<UIcon v-if="icon" :name="icon" :class="variant.iconBase" />
109111

110112
<UAvatar v-if="avatar" v-bind="{ size: variant.avatarSize, ...avatar }" :class="variant.avatarBase" />
@@ -122,12 +124,18 @@ export default defineComponent({
122124
</p>
123125

124126
<div v-if="(description || $slots.description) && actions.length" class="mt-3 flex items-center gap-2">
125-
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...nuxtLabsTheme.UAlert.base.default.actionButton, ...action }" @click.stop="action.click" />
127+
<UButton
128+
v-for="(action, index) of actions" :key="index"
129+
v-bind="{ ...nuxtLabsTheme.UAlert.base.default.actionButton, ...action }" @click.stop="action.click"
130+
/>
126131
</div>
127132
</div>
128133
<div class="flex-shrink-0 flex items-center gap-3">
129134
<div v-if="!description && !$slots.description && actions.length" class="flex items-center gap-2">
130-
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...nuxtLabsTheme.UAlert.base.default.actionButton, ...action }" @click.stop="action.click" />
135+
<UButton
136+
v-for="(action, index) of actions" :key="index"
137+
v-bind="{ ...nuxtLabsTheme.UAlert.base.default.actionButton, ...action }" @click.stop="action.click"
138+
/>
131139
</div>
132140
<UButton v-if="closeButton" v-bind="{ closeButtonClass, ...closeButton }" @click.stop="handleClose" />
133141
</div>

0 commit comments

Comments
 (0)