Skip to content

Commit

Permalink
fix(Button): pass-through nuxt link props to ULink
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jan 11, 2024
1 parent b0df864 commit a44bfc8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/runtime/components/elements/Button.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<ULink :type="type" :disabled="disabled || loading" :class="buttonClass" v-bind="attrs">
<ULink :type="type" :disabled="disabled || loading" :class="buttonClass" v-bind="{ ...linkProps, ...attrs }">
<slot name="leading" :disabled="disabled" :loading="loading">
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="leadingIconClass" aria-hidden="true" />
</slot>
Expand All @@ -23,7 +23,7 @@ import { twMerge, twJoin } from 'tailwind-merge'
import UIcon from '../elements/Icon.vue'
import ULink from '../elements/Link.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import { mergeConfig, omit } from '../../utils'

Check warning on line 26 in src/runtime/components/elements/Button.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

'omit' is defined but never used
import { nuxtLinkProps } from '../../utils/nuxt-link'
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
import type { ButtonColor, ButtonSize, ButtonVariant, Strategy } from '../../types'
Expand Down Expand Up @@ -192,6 +192,13 @@ export default defineComponent({
)
})
const linkProps = computed(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { type, block, label, loading, disabled, padded, size, color, variant, icon, loadingIcon, leadingIcon, trailingIcon, trailing, leading, square, truncate, class: className, ui, ...rest } = props
return rest
})
return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
Expand All @@ -203,7 +210,8 @@ export default defineComponent({
leadingIconName,
trailingIconName,
leadingIconClass,
trailingIconClass
trailingIconClass,
linkProps
}
}
})
Expand Down

1 comment on commit a44bfc8

@vercel
Copy link

@vercel vercel bot commented on a44bfc8 Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-git-dev-nuxt-js.vercel.app
ui-nuxt-js.vercel.app
ui.nuxt.com

Please sign in to comment.