2022-10-13 15:18:47 +00:00
|
|
|
<template>
|
2024-06-07 12:41:37 +00:00
|
|
|
<ExtraDrawerButton class="block md:hidden" @click.prevent="toggleSidebar">
|
|
|
|
<Icon :icon="faTimes" v-if="sidebarExpanded" fixed-width />
|
|
|
|
<Icon :icon="faBars" v-else fixed-width />
|
2024-04-04 22:20:42 +00:00
|
|
|
</ExtraDrawerButton>
|
2022-10-13 15:18:47 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-06-07 12:41:37 +00:00
|
|
|
import { faBars, faTimes } from '@fortawesome/free-solid-svg-icons'
|
2022-10-13 15:18:47 +00:00
|
|
|
import { eventBus } from '@/utils'
|
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
import ExtraDrawerButton from '@/components/layout/main-wrapper/extra-drawer/ExtraDrawerButton.vue'
|
2024-06-07 12:41:37 +00:00
|
|
|
import { ref } from 'vue'
|
2024-04-04 22:20:42 +00:00
|
|
|
|
2024-06-07 12:41:37 +00:00
|
|
|
const sidebarExpanded = ref(false)
|
|
|
|
|
|
|
|
const toggleSidebar = () => {
|
|
|
|
// Since the sidebar will be hidden if we click outside the menu anyway, we don't actually need
|
|
|
|
// to emit the event to collapse it. We just need to toggle the state to show the
|
|
|
|
// icon accordingly.
|
|
|
|
if (!sidebarExpanded.value) eventBus.emit('TOGGLE_SIDEBAR')
|
|
|
|
sidebarExpanded.value = !sidebarExpanded.value
|
|
|
|
}
|
2022-10-13 15:18:47 +00:00
|
|
|
</script>
|