Skip to content

Commit

Permalink
fix(controls): display toolbar when no custom controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Oct 6, 2022
1 parent 527f285 commit 51d0f26
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { PropType, ref, watch } from 'vue'
import { computed, PropType, ref, watch } from 'vue'
import { Icon } from '@iconify/vue'
import GenericRenderStory from '../story/GenericRenderStory.vue'
import type { Story, Variant } from '../../types'
Expand All @@ -25,6 +25,8 @@ const ready = ref(false)
watch(() => props.variant, () => {
ready.value = false
})
const hasCustomControls = computed(() => props.variant.slots().controls || props.story.slots().controls)
</script>

<template>
Expand All @@ -37,15 +39,15 @@ watch(() => props.variant, () => {
class="htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center"
>
<StatePresets
v-if="ready"
v-if="ready || !hasCustomControls"
:story="story"
:variant="variant"
/>
</div>

<!-- Custom controls -->
<GenericRenderStory
v-if="variant.slots().controls || story.slots().controls"
v-if="hasCustomControls"
:key="`${story.id}-${variant.id}`"
slot-name="controls"
:variant="variant"
Expand Down

0 comments on commit 51d0f26

Please sign in to comment.