koel/resources/assets/js/components/ui/SidebarMenuToggleButton.vue

21 lines
684 B
Vue
Raw Normal View History

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'
2024-06-16 15:40:33 +00:00
import { ref } from 'vue'
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
const sidebarExpanded = ref(false)
2024-06-16 15:40:33 +00:00
eventBus.on('TOGGLE_SIDEBAR', () => (sidebarExpanded.value = !sidebarExpanded.value))
const toggleSidebar = () => eventBus.emit('TOGGLE_SIDEBAR')
2022-10-13 15:18:47 +00:00
</script>