<template>
  <transition
      name="list-edit-transition"
      tag="div"
      class="list-edit-container"

  >
    <div v-if="show" class="list-edit">
      <div class="icon-container">
        <ph-selection size="24"/>
        <span class="number-circle">{{ selectCount }}</span></div>

        <basic-button icon="pencil-simple" @click="handleAction('edit')">Edit</basic-button>
        <basic-button icon="trash" @click="handleAction('delete')">Delete</basic-button>
        <basic-button icon="archive" @click="handleAction('archive')">Archive</basic-button>
        <basic-button icon="X" @click="handleAction('deselect')">Cancel</basic-button>


    </div>
  </transition>

</template>

<script>
import IconButton from "@/components/UI/IconButton.vue";
import {PhSelection} from "@phosphor-icons/vue";
import BasicButton from "@/components/UI/BasicButton.vue";

export default {
  name: "ListEdit",
  components: {BasicButton, PhSelection, IconButton},
  emits: ['action'],
  props: {
    show: {
      type: Boolean,
      default: false
    },
    selectCount: {
      type: Number,
      default: 1
    }
  },
  methods: {
    handleAction(action) {
      this.$emit('action', action);
    }
  }
}
</script>

<style scoped>

.list-edit-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 4000;
}

.list-edit {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  background-color: #5AF0B4;
  border-radius: 0.8rem;
  flex: 0 0 auto;
  padding: 0.8rem 1.6rem;
  box-shadow: 0 0.4rem 0.6rem -0.1rem rgba(0, 0, 0, 0.1);
  font-size: 1.4rem;
}

.list-edit-action {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.number-circle {
  position: relative;
  top: 0.8rem;
  left: -1.2rem;
  display: inline-block;

  border-radius: 50%;
  /*background-color: #002F54;
  color: white;*/
  color: #002F54;
  text-align: center;
  line-height: 1.6rem;
  font-size: 1.2rem;
  font-weight: 500;
}

.icon-container {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}


/* Transition animations */
.list-edit-transition-enter-active {
  transition: all 0.3s ease;
}

.list-edit-transition-leave-active {
  transition: all 0.3s ease;
}

.list-edit-transition-enter-from {
  opacity: 0;
  transform: translate(-50%, 100%); /* beide Transforms kombinieren */
}

.list-edit-transition-leave-to {
  opacity: 0;
  transform: translate(-50%, 100%); /* beide Transforms kombinieren */
}

.list-edit-transition-move {
  transition: transform 0.3s ease;
}

</style>