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

goToPageWithTabAndCollapsible

parent c5c553c9
No related branches found
No related tags found
No related merge requests found
Pipeline #407589 passed
......@@ -10,6 +10,16 @@ export const useNavigation = () => {
const goToTextsAndOpenCollapsible = (collapseId: string, path: string) => {
navigate(`${path}${collapseId}`);
};
return { goToPagesAndOpenTab, goToTextsAndOpenCollapsible };
const goToPageWithTabAndCollapsible = ({ path, tabId, collapseId }: { path: string, tabId: string, collapseId?: string }) => {
const navigate = useNavigate();
navigate(`${path}?tab=${tabId}${collapseId ? `&collapseId=${collapseId}` : ''}`);
};
/* <a onClick={() => goToPageWithTabAndCollapsible({
path: "/human-practices",
tabId: "InvWesthoff",
collapseId: "collapse-1" // ID of the collapsible to open
})}>
Go to Human Practices and Open Collapsible 1
</a> */
return { goToPagesAndOpenTab, goToTextsAndOpenCollapsible, goToPageWithTabAndCollapsible };
};
\ 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