Skip to content

Commit 5ce254d

Browse files
committed
simplify diff
1 parent 80133cf commit 5ce254d

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

packages/vuetify/src/components/VAlert/VAlert.tsx

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -106,34 +106,34 @@ export const VAlert = genericComponent<VAlertSlots>()({
106106
'update:modelValue': (value: boolean) => true,
107107
},
108108

109-
setup (props, { emit, slots }) {
110-
const _props = useDefaults(props)
109+
setup (_props, { emit, slots }) {
110+
const props = useDefaults(_props)
111111
const { getSlotDefaultsInfo } = useSlotDefaults()
112-
const isActive = useProxiedModel(_props, 'modelValue')
112+
const isActive = useProxiedModel(props, 'modelValue')
113113
const icon = toRef(() => {
114-
if (_props.icon === false) return undefined
115-
if (!_props.type) return _props.icon
114+
if (props.icon === false) return undefined
115+
if (!props.type) return props.icon
116116

117-
return _props.icon ?? `$${_props.type}`
117+
return props.icon ?? `$${props.type}`
118118
})
119119

120-
const { iconSize } = useIconSizes(_props, () => _props.prominent ? 44 : undefined)
121-
const { themeClasses } = provideTheme(_props)
120+
const { iconSize } = useIconSizes(props, () => props.prominent ? 44 : undefined)
121+
const { themeClasses } = provideTheme(props)
122122
const { colorClasses, colorStyles, variantClasses } = useVariant(() => ({
123-
color: _props.color ?? _props.type,
124-
variant: _props.variant,
123+
color: props.color ?? props.type,
124+
variant: props.variant,
125125
}))
126-
const { densityClasses } = useDensity(_props)
127-
const { dimensionStyles } = useDimension(_props)
128-
const { elevationClasses } = useElevation(_props)
129-
const { locationStyles } = useLocation(_props)
130-
const { positionClasses } = usePosition(_props)
131-
const { roundedClasses } = useRounded(_props)
132-
const { textColorClasses, textColorStyles } = useTextColor(() => _props.borderColor)
126+
const { densityClasses } = useDensity(props)
127+
const { dimensionStyles } = useDimension(props)
128+
const { elevationClasses } = useElevation(props)
129+
const { locationStyles } = useLocation(props)
130+
const { positionClasses } = usePosition(props)
131+
const { roundedClasses } = useRounded(props)
132+
const { textColorClasses, textColorStyles } = useTextColor(() => props.borderColor)
133133
const { t } = useLocale()
134134

135135
const closeProps = toRef(() => ({
136-
'aria-label': t(_props.closeLabel),
136+
'aria-label': t(props.closeLabel),
137137
onClick (e: MouseEvent) {
138138
isActive.value = false
139139

@@ -142,51 +142,51 @@ export const VAlert = genericComponent<VAlertSlots>()({
142142
}))
143143

144144
// Helper function to wrap slot content with defaults
145-
function wrapSlot(slotName: string, slotFn: (() => any) | undefined, fallbackContent?: any) {
145+
function wrapSlot (slotName: string, slotFn: (() => any) | undefined, fallbackContent?: any) {
146146
const slotDefaultsInfo = getSlotDefaultsInfo(slotName)
147-
147+
148148
if (!slotDefaultsInfo && !slotFn) {
149149
return fallbackContent
150150
}
151-
151+
152152
if (!slotDefaultsInfo) {
153153
return slotFn?.() ?? fallbackContent
154154
}
155-
155+
156156
const { componentDefaults, directProps } = slotDefaultsInfo
157-
157+
158158
return (
159-
<VDefaultsProvider defaults={componentDefaults as any}>
160-
<div {...directProps}>
161-
{slotFn?.() ?? fallbackContent}
159+
<VDefaultsProvider defaults={ componentDefaults as any }>
160+
<div { ...directProps }>
161+
{ slotFn?.() ?? fallbackContent }
162162
</div>
163163
</VDefaultsProvider>
164164
)
165165
}
166166

167167
return () => {
168168
const hasPrepend = !!(slots.prepend || icon.value)
169-
const hasTitle = !!(slots.title || _props.title)
170-
const hasClose = !!(slots.close || _props.closable)
169+
const hasTitle = !!(slots.title || props.title)
170+
const hasClose = !!(slots.close || props.closable)
171171

172172
const iconProps = {
173-
density: _props.density,
173+
density: props.density,
174174
icon: icon.value,
175-
size: _props.iconSize || _props.prominent
175+
size: props.iconSize || props.prominent
176176
? iconSize.value
177177
: undefined,
178178
}
179179

180180
return isActive.value && (
181-
<_props.tag
181+
<props.tag
182182
class={[
183183
'v-alert',
184-
_props.border && {
185-
'v-alert--border': !!_props.border,
186-
[`v-alert--border-${_props.border === true ? 'start' : _props.border}`]: true,
184+
props.border && {
185+
'v-alert--border': !!props.border,
186+
[`v-alert--border-${props.border === true ? 'start' : props.border}`]: true,
187187
},
188188
{
189-
'v-alert--prominent': _props.prominent,
189+
'v-alert--prominent': props.prominent,
190190
},
191191
themeClasses.value,
192192
colorClasses.value,
@@ -195,19 +195,19 @@ export const VAlert = genericComponent<VAlertSlots>()({
195195
positionClasses.value,
196196
roundedClasses.value,
197197
variantClasses.value,
198-
_props.class,
198+
props.class,
199199
]}
200200
style={[
201201
colorStyles.value,
202202
dimensionStyles.value,
203203
locationStyles.value,
204-
_props.style,
204+
props.style,
205205
]}
206206
role="alert"
207207
>
208208
{ genOverlays(false, 'v-alert') }
209209

210-
{ _props.border && (
210+
{ props.border && (
211211
<div
212212
key="border"
213213
class={[
@@ -237,11 +237,11 @@ export const VAlert = genericComponent<VAlertSlots>()({
237237
<div class="v-alert__content">
238238
{ hasTitle && (
239239
<VAlertTitle key="title">
240-
{ wrapSlot('title', slots.title, _props.title) }
240+
{ wrapSlot('title', slots.title, props.title) }
241241
</VAlertTitle>
242242
)}
243243

244-
{ wrapSlot('text', slots.text, _props.text) }
244+
{ wrapSlot('text', slots.text, props.text) }
245245

246246
{ wrapSlot('default', slots.default) }
247247
</div>
@@ -257,7 +257,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
257257
{ !slots.close ? (
258258
<VBtn
259259
key="close-btn"
260-
icon={ _props.closeIcon }
260+
icon={ props.closeIcon }
261261
size="x-small"
262262
variant="text"
263263
{ ...closeProps.value }
@@ -267,7 +267,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
267267
key="close-defaults"
268268
defaults={{
269269
VBtn: {
270-
icon: _props.closeIcon,
270+
icon: props.closeIcon,
271271
size: 'x-small',
272272
variant: 'text',
273273
},
@@ -278,7 +278,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
278278
)}
279279
</div>
280280
)}
281-
</_props.tag>
281+
</props.tag>
282282
)
283283
}
284284
},

0 commit comments

Comments
 (0)