<template>
  <div class="application-unit-container grid-stack-item">
    <div
      class="application-unit grid-stack-item-content"
      :data-appId="config.id"
      draggable
      @mousedown="dragstart"
    >
      <HIcon
        name="hoteam-organization-management"
        size="22"
        style="pointer-events: none"
        :data-appId="config.id"
      ></HIcon>
      <span :data-appId="config.id" class="application-unit-name" :draggable="false">
        {{ config.name }}
      </span>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'applicationUnit',
  props: {
    config: {
      type: Object,
      default: () => {},
    },
  },

  setup(_props) {
    const dragstart = e => {
      e.stopPropagation();
    };

    return {
      dragstart,
    };
  },
});
</script>

<style scoped lang="less">
.application-unit {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 100%;
  margin-bottom: 8px;
  cursor: pointer;
}

.application-unit-name {
  pointer-events: none;
  display: inline-block;
  text-align: center;
}
</style>
