From 263c308116b68a6ab113de33345a0f63e82745c2 Mon Sep 17 00:00:00 2001 From: zmigroo Date: Thu, 7 Dec 2023 12:17:31 +0100 Subject: [PATCH 01/13] prepare for adding provider app buttons --- .../js/Shared/Components/ProviderIcons.vue | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/resources/js/Shared/Components/ProviderIcons.vue b/resources/js/Shared/Components/ProviderIcons.vue index eef49127..7fb28bdd 100644 --- a/resources/js/Shared/Components/ProviderIcons.vue +++ b/resources/js/Shared/Components/ProviderIcons.vue @@ -2,6 +2,7 @@ const props = defineProps({ item: Object, providers: Object, + apps: Object, }) function getProviderColor(providerName) { @@ -10,15 +11,53 @@ function getProviderColor(providerName) { return provider ? provider.color : '' } +// function getProviderUrl(providerName) { +// const provider = props.providers.find(provider => provider.name === providerName) +// +// return provider ? provider.url : '' +// } + +// make buttons visible if provider is clicked and hide if clicked again and hide if clicked outside, if clicked .provider-icon, remove hidden class from .provider-buttons and add hidden class to all other .provider-buttons +document.addEventListener('click', function(event) { + if (!event.target.closest('.provider-buttons') && !event.target.closest('.provider-icon')) { + document.querySelectorAll('.provider-buttons').forEach(element => { + element.classList.add('hidden') + }) + } + + if (event.target.closest('.provider-icon')) { + event.target.closest('.provider-icon').querySelector('.provider-buttons').classList.remove('hidden') + document.querySelectorAll('.provider-icon').forEach(element => { + if (element !== event.target.closest('.provider-icon')) { + element.querySelector('.provider-buttons').classList.add('hidden') + } + }) + } + +}) +