Skip to content

Commit

Permalink
refactor(vue-flow,components): hide/show slots in Controls.vue
Browse files Browse the repository at this point in the history
# What's changed?

* depending on props, hide slot as well
* rename `control-fitview` to `control-fit-view`
  • Loading branch information
bcakmakoglu committed Jun 15, 2022
1 parent 1400011 commit 32086e0
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions packages/vue-flow/src/additional-components/Controls/Controls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,27 @@ export default {
</ControlButton>
</slot>
</template>
<slot name="control-fitview">
<ControlButton v-if="showFitView" class="vue-flow__controls-fitview" @click="onFitViewHandler">
<slot name="icon-fitview">
<FitView />
</slot>
</ControlButton>
</slot>
<slot name="control-interactive">
<ControlButton v-if="showInteractive" class="vue-flow__controls-interactive" @click="onInteractiveChangeHandler">
<slot name="icon-unlock">
<Unlock v-if="isInteractive" />
</slot>
<slot name="icon-lock">
<Lock v-if="!isInteractive" />
</slot>
</ControlButton>
</slot>
<template v-if="showFitView">
<slot name="control-fit-view">
<ControlButton class="vue-flow__controls-fitview" @click="onFitViewHandler">
<slot name="icon-fit-view">
<FitView />
</slot>
</ControlButton>
</slot>
</template>
<template v-if="showInteractive">
<slot name="control-interactive">
<ControlButton v-if="showInteractive" class="vue-flow__controls-interactive" @click="onInteractiveChangeHandler">
<slot name="icon-unlock">
<Unlock v-if="isInteractive" />
</slot>
<slot name="icon-lock">
<Lock v-if="!isInteractive" />
</slot>
</ControlButton>
</slot>
</template>
<slot></slot>
</div>
</template>

0 comments on commit 32086e0

Please sign in to comment.