Skip to content

Commit

Permalink
fix(Accordion): solve the shift between buttons when they are opened (n…
Browse files Browse the repository at this point in the history
…uxt#379)

Co-authored-by: Benjamin Canac <[email protected]>
  • Loading branch information
Haythamasalama and benjamincanac authored Jul 3, 2023
1 parent b78fcf9 commit eaf0043
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/runtime/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ const dropdown = {
}

const accordion = {
wrapper: 'w-full flex flex-col gap-y-2',
wrapper: 'w-full flex flex-col',
item: {
base: '',
size: 'text-sm',
color: 'text-gray-500 dark:text-gray-400',
padding: 'py-2'
padding: 'pt-1.5 pb-3'
},
transition: {
enterActiveClass: 'overflow-hidden transition-[height] duration-200 ease-out',
Expand All @@ -273,6 +273,7 @@ const accordion = {
default: {
openIcon: 'i-heroicons-chevron-down-20-solid',
closeIcon: '',
class: 'mb-1.5 w-full',
variant: 'soft'
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/elements/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<HDisclosure v-for="(item, index) in items" v-slot="{ open, close }" :key="index" :default-open="defaultOpen || item.defaultOpen">
<HDisclosureButton :ref="() => buttonRefs[index] = close" as="template" :disabled="item.disabled">
<slot :item="item" :index="index" :open="open" :close="close">
<UButton v-bind="{ ...omit(ui.default, ['openIcon', 'closeIcon']), ...$attrs, ...omit(item, ['slot', 'disabled', 'content', 'defaultOpen']) }" class="w-full">
<UButton v-bind="{ ...omit(ui.default, ['openIcon', 'closeIcon']), ...$attrs, ...omit(item, ['slot', 'disabled', 'content', 'defaultOpen']) }">
<template #trailing>
<UIcon
:name="!open ? openIcon : closeIcon ? closeIcon : openIcon"
Expand Down

0 comments on commit eaf0043

Please sign in to comment.