diff --git a/src/components/Buttons.tsx b/src/components/Buttons.tsx index db9a5c564fba8890134291ddf07c0acce8f01815..f1765faae7faec19deecfc546fbb4b3ca9fd7777 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 f0e8513ff0616ef650c11110e2df955166b56bcc..8a04423220187423f2d4239e8a278588cf0f6cc6 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"; }