From f9b5baae85b8f43274e76d8e0f889f33a79007dc Mon Sep 17 00:00:00 2001 From: a-ill Date: Fri, 28 Jul 2023 21:20:07 +0300 Subject: [PATCH] Reworked navbar --- .../public/locales/en/navbar-component.json | 2 +- .../public/locales/ru/navbar-component.json | 2 +- .../svelte/src/navbar/navbar-component.svelte | 131 +++++++----------- .../public/js/components/navbar-component.js | 2 +- .../public/locales/en/navbar-component.json | 2 +- .../public/locales/ru/navbar-component.json | 2 +- 6 files changed, 57 insertions(+), 84 deletions(-) diff --git a/Server/app/svelte/public/locales/en/navbar-component.json b/Server/app/svelte/public/locales/en/navbar-component.json index 6ecb2b3..d4e3eda 100644 --- a/Server/app/svelte/public/locales/en/navbar-component.json +++ b/Server/app/svelte/public/locales/en/navbar-component.json @@ -2,7 +2,7 @@ "orgName": "Libertarian socialists", "manifesto": "Manifesto", "joinUs": "Join us", - "aboutUs": "About us", + "initiatives": "Initiatives", "groups": "Groups", "communes": "Communes", "cooperatives": "Cooperatives", diff --git a/Server/app/svelte/public/locales/ru/navbar-component.json b/Server/app/svelte/public/locales/ru/navbar-component.json index ae8f1b9..527efd5 100644 --- a/Server/app/svelte/public/locales/ru/navbar-component.json +++ b/Server/app/svelte/public/locales/ru/navbar-component.json @@ -2,7 +2,7 @@ "orgName": "Либертарные социалисты", "manifesto": "Манифест", "joinUs": "Присоединяйся", - "aboutUs": "О нас", + "initiatives": "Инициативы", "groups": "Группы", "communes": "Коммуны", "cooperatives": "Кооперативы", diff --git a/Server/app/svelte/src/navbar/navbar-component.svelte b/Server/app/svelte/src/navbar/navbar-component.svelte index 17411f3..a5c6f64 100644 --- a/Server/app/svelte/src/navbar/navbar-component.svelte +++ b/Server/app/svelte/src/navbar/navbar-component.svelte @@ -10,7 +10,8 @@ // Main code let hambInput let navbar - let localesDropdown; + let localesDropdown + let initiativesDropdown let loaded = writable(0) let content = writable({}) let logoText @@ -33,12 +34,15 @@ } } - function showLocales() { - if (localesDropdown.style.display=="block") { - localesDropdown.style.display = "none" + function showDropdown(dropdown) { + let state = dropdown.style.display + initiativesDropdown.style.display = "none" + localesDropdown.style.display = "none" + if (state=="block") { + dropdown.style.display = "none" } else { - localesDropdown.style.display = "block" + dropdown.style.display = "block" } } @@ -75,9 +79,15 @@ } } + function hide(dropdown) { + let callback = () => { + dropdown.style.display = "none" + } + setTimeout(callback,100) + } onMount(() => { - + fixHeading() }) @@ -85,7 +95,6 @@ {#key loaded} {#if Object.keys($content).length!=0} - {fixHeading()}{console.log($content)}