From 336e51bd1de8b4471c44a7afbe0eddb450e9c9a4 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 17 Nov 2020 13:32:15 +0100 Subject: [PATCH] fix toggle sidebar --- src/components/Main.vue | 13 +++++++++---- src/components/Sidebar.vue | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/Main.vue b/src/components/Main.vue index 5752541..f1e26b0 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -36,7 +36,8 @@ + :sidebar-station="sidebarStation" + @toggleSidebar="toggleSidebar" /> @@ -332,9 +333,13 @@ export default { }) }, - toggleSidebar(station) { - this.showSidebar = true - this.sidebarStation = station + toggleSidebar(station = null) { + if (station) { + this.showSidebar = true + this.sidebarStation = station + } else { + this.showSidebar = false + } }, }, } diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index f775ca8..9300ba5 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -5,7 +5,7 @@ :subtitle="stationTags" :background="sidebarStation.favicon" class="has-preview" - @close="showSidebar=false"> + @close="toggleSidebar">
@@ -90,6 +90,11 @@ export default { return '' }, }, + methods: { + toggleSidebar(station) { + this.$emit('toggleSidebar') + }, + }, }