<script setup>
import { ref } from 'vue'
defineOptions({
  name: 'ToggleBar'
})

const emits = defineEmits(['barClick'])

const model = defineModel(false)

const toggle = () => {
  model.value = !model.value
  emits('barClick', !model.value)
}
</script>

<template>
  <div class="v-menu-toggle-bar" :class="{ collapse: model }" @click="toggle">
    <VIcon name="ArrowLeft" size="14"></VIcon>
  </div>
</template>

<style>
.v-menu-toggle-bar {
  cursor: pointer;
  width: var(--v-bar-width);
  height: var(--v-bar-width);
  position: absolute;
  top: 50%;
  right: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--v-border-color);
  border: 1px solid var(--v-border-color);
  background-color: var(--v-light-bg);
  box-shadow: 0 2px 4px 0px rgba(0, 0, 0, 0.06);
  transform: translateX(50%) translateY(-50%);
  z-index: 1;
}
.v-menu-toggle-bar.collapse .el-icon {
  transform: rotate(180deg);
}
</style>