Skip to content

Commit

Permalink
fix(VExpansionPanelTitle): propagate VIcon defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Jun 12, 2024
1 parent a30a859 commit cec2094
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Components
import { VExpansionPanelSymbol } from './shared'
import { VDefaultsProvider } from '@/components/VDefaultsProvider'
import { VIcon } from '@/components/VIcon'

// Composables
Expand Down Expand Up @@ -75,6 +76,8 @@ export const VExpansionPanelTitle = genericComponent<VExpansionPanelTitleSlots>(
readonly: props.readonly,
}))

const icon = computed(() => expansionPanel.isSelected.value ? props.collapseIcon : props.expandIcon)

useRender(() => (
<button
class={[
Expand Down Expand Up @@ -103,12 +106,17 @@ export const VExpansionPanelTitle = genericComponent<VExpansionPanelTitleSlots>(
{ slots.default?.(slotProps.value) }

{ !props.hideActions && (
<span class="v-expansion-panel-title__icon">
{
slots.actions ? slots.actions(slotProps.value)
: <VIcon icon={ expansionPanel.isSelected.value ? props.collapseIcon : props.expandIcon } />
}
</span>
<VDefaultsProvider
defaults={{
VIcon: {
icon: icon.value,
},
}}
>
<span class="v-expansion-panel-title__icon">
{ slots.actions?.(slotProps.value) ?? <VIcon /> }
</span>
</VDefaultsProvider>
)}
</button>
))
Expand Down

0 comments on commit cec2094

Please sign in to comment.