From 442bc255591024441ada6f16beacf09a8ae5ed30 Mon Sep 17 00:00:00 2001 From: liliana <liliana.sanfilippo@uni-bielefeld.de> Date: Fri, 19 Jul 2024 09:10:02 +0200 Subject: [PATCH] Did // eventuell noch eine dritte optionale variable was sonst noch alles geschlossen werden soll //also wenn tabtabs gewechselt wird sollen alle tabbys geschlossen werden --- src/components/Buttons.tsx | 10 +++++----- src/contents/human-practices.tsx | 13 +++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/Buttons.tsx b/src/components/Buttons.tsx index db9a5c56..f1765faa 100644 --- a/src/components/Buttons.tsx +++ b/src/components/Buttons.tsx @@ -79,11 +79,11 @@ export function HPButtonrow(){ return( <> <div className="align-items-center bottom-buttons"> - <button className="active" onClick={openTab({cityName: "All", cla: "tabtabs"})}> All</button> - <button onClick={openTab({cityName: "Patient", cla: "tabtabs"})}> Patients</button> - <button onClick={openTab({cityName: "Academia", cla: "tabtabs"})}> Academia</button> - <button onClick={openTab({cityName: "Medical", cla: "tabtabs"})}> Medical professionals</button> - <button onClick={openTab({cityName: "Industry", cla: "tabtabs"})}> Industry</button> + <button className="active" onClick={openTab({cityName: "All", cla: "tabtabs", weg:"tabbys"})}> All</button> + <button onClick={openTab({cityName: "Patient", cla: "tabtabs", weg:"tabbys"})}> Patients</button> + <button onClick={openTab({cityName: "Academia", cla: "tabtabs", weg:"tabbys"})}> Academia</button> + <button onClick={openTab({cityName: "Medical", cla: "tabtabs", weg:"tabbys"})}> Medical professionals</button> + <button onClick={openTab({cityName: "Industry", cla: "tabtabs", weg:"tabbys"})}> Industry</button> </div> </> ) diff --git a/src/contents/human-practices.tsx b/src/contents/human-practices.tsx index f0e8513f..8a044232 100644 --- a/src/contents/human-practices.tsx +++ b/src/contents/human-practices.tsx @@ -102,8 +102,7 @@ let tabtabs = [ } ] -// eventuell noch eine dritte optionale variable was sonst noch alles geschlossen werden soll -//also wenn tabtabs gewechselt wird sollen alle tabbys geschlossen werden + export function HumanPractices() { openTab({cityName: "All", cla: "tabtabs"}); return ( @@ -116,9 +115,9 @@ export function HumanPractices() { ); } -export function openTab({cityName, cla}:{cityName: string, cla: string}) { +export function openTab({cityName, cla, weg}:{cityName: string, cla: string, weg?: string}) { const opencity = (event : React.MouseEvent<HTMLButtonElement, MouseEvent>) =>{ - var i, tabcontent, tablinks; + var i, tabcontent, tablinks, wegcontent; tabcontent = document.getElementsByClassName(cla); for (i = 0; i < tabcontent.length; i++) { (tabcontent[i] as HTMLElement).style.display = "none"; @@ -127,6 +126,12 @@ export function openTab({cityName, cla}:{cityName: string, cla: string}) { for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } + if (weg){ + wegcontent = document.getElementsByClassName(weg); + for (i = 0; i < wegcontent.length; i++) { + (wegcontent[i] as HTMLElement).style.display = "none"; + } + } document.getElementById(cityName)!.style.display = "block"; event.currentTarget.className += " active"; } -- GitLab