<template>
  <q-drawer
    :model-value="drawer"
    show-if-above
    :width="200"
    :breakpoint="1024"
    @update:model-value="$emit('drawer-toggle')"
  >
    <q-scroll-area class="fit">
      <q-list padding class="menu-list">
        <template v-for="link in links" :key="link.name">
          <q-item clickable v-ripple :to="link.to">
            <q-item-section avatar>
              <q-icon :name="link.icon" />
            </q-item-section>

            <q-item-section> {{ link.name }} </q-item-section>
          </q-item>
        </template>
        <q-item clickable v-ripple @click="logout()">
          <q-item-section avatar><q-icon name="logout" /></q-item-section
          ><q-item-section>Logout</q-item-section>
        </q-item>
      </q-list>
    </q-scroll-area>
  </q-drawer>
</template>

<script lang="ts" setup>
import { defineComponent } from 'vue';
import { links } from 'src/router/navlinks.js';
import { logout } from 'boot/appwrite';

defineProps(['drawer']);
defineEmits(['drawer-toggle']);

defineComponent({
  name: 'LeftDrawer',
});
</script>

<style lang="sass" scoped>
.menu-list .q-item
  border-radius: 0 32px 32px 0
</style>
