From 089defd0b68f9e6dde7344d860fb60f84523d289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 13 Jul 2022 17:02:54 +0200 Subject: Fix missing Talk sidebar trigger in public share pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the removal of SCSS files the "menu-people" icon can no longer be used directly with a CSS class. However, it is available as a Vue component; although it would be possible to directly render the Vue component for the icon inside the button element the whole button is moved to Vue instead, as the other approach requires more fighting with the styles. As the icon will be shown with a transparent background on the header, which uses the primary color, the fill color of the icon needs to be explicitly set to the primary text color. Signed-off-by: Daniel Calviño Sánchez --- src/PublicShareSidebarTrigger.vue | 73 +++++++++++++++++++++++++++++++++++++++ src/mainPublicShareSidebar.js | 16 ++++++--- 2 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 src/PublicShareSidebarTrigger.vue (limited to 'src') diff --git a/src/PublicShareSidebarTrigger.vue b/src/PublicShareSidebarTrigger.vue new file mode 100644 index 000000000..99a049ede --- /dev/null +++ b/src/PublicShareSidebarTrigger.vue @@ -0,0 +1,73 @@ + + + + + + + diff --git a/src/mainPublicShareSidebar.js b/src/mainPublicShareSidebar.js index f2ba41d77..ee4f468be 100644 --- a/src/mainPublicShareSidebar.js +++ b/src/mainPublicShareSidebar.js @@ -21,6 +21,7 @@ import Vue from 'vue' import VueObserveVisibility from 'vue-observe-visibility' import PublicShareSidebar from './PublicShareSidebar.vue' +import PublicShareSidebarTrigger from './PublicShareSidebarTrigger.vue' import './init.js' // Store @@ -98,10 +99,6 @@ if (window.innerWidth > 1111) { function addTalkSidebarTrigger() { const talkSidebarTriggerElement = document.createElement('button') talkSidebarTriggerElement.setAttribute('id', 'talk-sidebar-trigger') - talkSidebarTriggerElement.setAttribute('class', 'icon-menu-people-white') - talkSidebarTriggerElement.addEventListener('click', () => { - sidebarState.isOpen = !sidebarState.isOpen - }) // The ".header-right" element may not exist in the public share page if // there are no header actions. @@ -112,6 +109,17 @@ function addTalkSidebarTrigger() { } document.querySelector('.header-right').appendChild(talkSidebarTriggerElement) + + const talkSidebarTriggerVm = new Vue({ + propsData: { + sidebarState, + }, + ...PublicShareSidebarTrigger, + }) + talkSidebarTriggerVm.$on('click', () => { + sidebarState.isOpen = !sidebarState.isOpen + }) + talkSidebarTriggerVm.$mount('#talk-sidebar-trigger') } addTalkSidebarTrigger() -- cgit v1.2.3