Files
n8n-enterprise-unlocked/packages/design-system/src/components/N8nTooltip/Tooltip.vue
Iván Ovejero 57aab63c10 refactor: Integrate consistent-type-imports in FE packages (no-changelog) (#6060)
* 👕 Move `consistent-type-imports` to top level

* 👕 Apply lintfixes

* 👕 Apply more lintfixes

* 👕 More lintfixes

* 👕 More lintfixes
2023-04-24 12:18:24 +02:00

69 lines
1.3 KiB
Vue

<template>
<el-tooltip v-bind="$attrs">
<template v-for="(_, slotName) in $slots" #[slotName]>
<slot :name="slotName" />
<div
:key="slotName"
v-if="slotName === 'content' && buttons.length"
:class="$style.buttons"
:style="{ justifyContent: justifyButtons }"
>
<n8n-button
v-for="button in buttons"
:key="button.attrs.label"
v-bind="button.attrs"
v-on="button.listeners"
/>
</div>
</template>
</el-tooltip>
</template>
<script lang="ts">
import type { PropType } from 'vue';
import { defineComponent } from 'vue';
import { Tooltip as ElTooltip } from 'element-ui';
import type { IN8nButton } from '@/types';
import N8nButton from '../N8nButton';
export default defineComponent({
name: 'n8n-tooltip',
inheritAttrs: false,
components: {
ElTooltip,
N8nButton,
},
props: {
justifyButtons: {
type: String,
default: 'flex-end',
validator: (value: string): boolean =>
[
'flex-start',
'flex-end',
'start',
'end',
'left',
'right',
'center',
'space-between',
'space-around',
'space-evenly',
].includes(value),
},
buttons: {
type: Array as PropType<IN8nButton[]>,
default: () => [],
},
},
});
</script>
<style lang="scss" module>
.buttons {
display: flex;
align-items: center;
margin-top: var(--spacing-s);
}
</style>