From fe125bb9766b6c33298d3f430ee9446305f491d5 Mon Sep 17 00:00:00 2001 From: vekaste <vekaste@stud.ntnu.no> Date: Thu, 18 Apr 2024 12:55:08 +0200 Subject: [PATCH] feat: Made it so only one panel can be opened at a time on roadmap. --- .../SavingGoalComponents/SavingGoalRoadmap.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/SavingGoalComponents/SavingGoalRoadmap.vue b/src/components/SavingGoalComponents/SavingGoalRoadmap.vue index c1b4739..4532527 100644 --- a/src/components/SavingGoalComponents/SavingGoalRoadmap.vue +++ b/src/components/SavingGoalComponents/SavingGoalRoadmap.vue @@ -25,7 +25,16 @@ export default { }, methods: { togglePanel(step: Step) { - step.showPanel = !step.showPanel; + if (step.showPanel) { + // If the clicked panel is already open, close it + step.showPanel = false; + } else { + //Close all panels before opening new one + //Ensure only one panel open at a time + this.steps.forEach((s) => (s.showPanel = false)); + //Open clicked on panel + step.showPanel = true; + } }, }, }; @@ -96,14 +105,14 @@ export default { .timeline>li:nth-child(even) { position: relative; margin-bottom: 50px; - height: 180px; + height: 100px; right:-100px; } .timeline>li:nth-child(odd) { position: relative; margin-bottom: 50px; - height: 180px; + height: 100px; left:-100px; } -- GitLab