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

lik fix

parent e7e74be8
No related branches found
No related tags found
No related merge requests found
Pipeline #531607 failed
......@@ -10,14 +10,17 @@ export function TabScrollLink({tab, scrollId, num}:{tab: string, scrollId: strin
// 2^4 = 16 possible combinations
export function OurLink({path, scrollToId, tabId, subTabId, collapseId, text}:Ourlink){
// 2^4 = 16 possible combinations + 1 special case
export function OurLink({path, scrollToId, tabId, subTabId, collapseId, text, tabincolId}:Ourlink){
const {goToPlace} = useNavigation();
// 1. [1-1-1-1] go to page and open tab and open collapsible and open subtab in collapsible and scroll to something
if(tabId && subTabId && scrollToId && collapseId) {
if(tabId && subTabId && scrollToId && collapseId && !tabincolId) {
return(<a onClick={() => goToPlace({path: path, tabId: tabId, subTabId: subTabId, scrollToId:scrollToId, collapseId:collapseId})}>{text}</a>)
}
// special case if tab in collapsible shall be opened
if(tabId && subTabId && scrollToId && collapseId && tabincolId) {
return(<a onClick={() => goToPlace({path: path, tabId: tabId, subTabId: subTabId, scrollToId:scrollToId, collapseId:collapseId, tabincolId:tabincolId})}>{text}</a>)
}
// 2. [1-1-1-0] go to page and open tab and open subtab and scroll to something
else if (tabId && subTabId && scrollToId && !collapseId){
return(<a onClick={() => goToPlace({path: path, tabId: tabId, subTabId: subTabId, scrollToId:scrollToId})}>{text}</a>)
......
......@@ -4,5 +4,6 @@ export interface Ourlink{
scrollToId?: string,
tabId?: string,
subTabId?: string,
collapseId?: string
collapseId?: string,
tabincolId?: string
}
\ No newline at end of file
......@@ -52,26 +52,29 @@ export const useNavigation = () => {
const goToPlace = ({ path, scrollToId,tabId, subTabId, collapseId}: { path: string, scrollToId?: string, tabId?: string, subTabId?: string, collapseId?: string}) => {
const goToPlace = ({ path, scrollToId,tabId, subTabId, collapseId, tabincolId}: { path: string, scrollToId?: string, tabId?: string, subTabId?: string, collapseId?: string, tabincolId?: string}) => {
let url = `${path}`;
if (tabId) {
url += `?tab=${tabId}`;
if (collapseId) {
url += `&collapseId=${collapseId}`;
}
if (subTabId) {
url += `&subTab=${subTabId}`;
}
}
if (collapseId && !tabId) {
url += `?collapseId=${collapseId}`;
if (subTabId) {
url += `&subTab=${subTabId}`;
if (tabincolId) {
url += `&colTab=${tabincolId}`;
}
}
if (collapseId) {
url += `&collapseId=${collapseId}`;
if (tabincolId) {
url += `&colTab=${tabincolId}`;
}
}
if (scrollToId && !tabId) {
if (scrollToId && !tabId || scrollToId && !collapseId) {
url += `?scrollTo=${scrollToId}`;
} else if (scrollToId && tabId) {
} else if (scrollToId && tabId || scrollToId && collapseId) {
url += `&scrollTo=${scrollToId}`;
}
navigate(url);
......
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