Skip to content
Snippets Groups Projects
Commit c051db4b authored by Liliana Sanfilippo's avatar Liliana Sanfilippo
Browse files

fixed useNavigate

parent c6d66c1c
No related branches found
No related tags found
No related merge requests found
Pipeline #407586 passed
import { useNavigate } from "react-router-dom";
/* import { useNavigate } from "react-router-dom"; */
export const goTo = (el: HTMLElement): void => {
const elementTop = el.getBoundingClientRect().top;
......@@ -50,12 +50,12 @@ export const SupScrollLink : React.FC<SupScrollLinkProps> = ({label }) => {
</sup>
);
};
export const goToTextsAndOpenCollapsible = (collapseId: string) => {
/*
export const goToTextsAndOpenCollapsible = ({collapseId, path}: {collapseId: string, path: string}) => {
const navigate = useNavigate();
navigate(collapseId);
navigate(`${path}${collapseId}`);
};
export const goToPagesAndOpenTab = (tabId: string) => {
export const goToPagesAndOpenTab = (tabId: string, path: string) => {
const navigate = useNavigate();
navigate(tabId);
};
\ No newline at end of file
navigate(`${path}${tabId}`);
}; */
\ No newline at end of file
import { ButtonOne} from "../components/Buttons";
import { goToPagesAndOpenTab, goToTextsAndOpenCollapsible } from "../components/goto";
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
import { openFromOtherPage } from "../components/Buttons";
import { useNavigation } from "../utils/useNavigation";
export function Education() {
const { goToPagesAndOpenTab, goToTextsAndOpenCollapsible } = useNavigation();
const location = useLocation();
useEffect(() => {
const params = new URLSearchParams(location.search);
......@@ -37,9 +38,9 @@ export function Education() {
<>
<div>
<h2>Interviews Page</h2>
<button onClick={() => goToTextsAndOpenCollapsible("/description?collapseId=symptoms-collapsible")}>
<a onClick={() => goToTextsAndOpenCollapsible("symptoms-collapsible", "/description?collapseId=")}> {/* */}
Go to Texts and Open Collapsible 1
</button>
</a>
</div>
<div className="row align-items-center" style={{marginTop: "5vh", marginBottom: "5vh"}}>
<div className="col">
......@@ -96,7 +97,7 @@ export function Education() {
<h3>Why and in which ways were we invested in MUKOmove? </h3>
<p>We did not stop at our participation itself – we wanted to make other people from our university and city
aware of the event and collect sport hours for cystic fibrosis with them by inviting them to join our team.
Our survey about cystic fibrosis awareness and our discussions with <a onClick={() => goToPagesAndOpenTab('/human-practices?tab=InvWesthoff')}>Kathrin Westhoff</a>, the head of a
Our survey about cystic fibrosis awareness and our discussions with <a onClick={() => goToPagesAndOpenTab('InvWesthoff', '/human-practices?tab=')}>Kathrin Westhoff</a>, the head of a
practice for physiotherapy in Gütersloh who is also treating young CF patients, showed us how little known
this illness still is. Especially the interview with the physiotherapist made us realize how important
exercise is for everyone and how it brings a community together – we wanted to establish MUKOmove in
......
import { useNavigate } from "react-router-dom";
export const useNavigation = () => {
const navigate = useNavigate();
const goToPagesAndOpenTab = (tabId: string, path: string) => {
navigate(`${path}${tabId}`);
};
const goToTextsAndOpenCollapsible = (collapseId: string, path: string) => {
navigate(`${path}${collapseId}`);
};
return { goToPagesAndOpenTab, goToTextsAndOpenCollapsible };
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment