From deea0f424e8fd88c56685d1dbd6585e75357617d Mon Sep 17 00:00:00 2001 From: Liliana Sanfilippo <lsanfilippo@techfak.uni-bielefeld.de> Date: Sat, 23 Nov 2024 12:02:58 +0100 Subject: [PATCH] added seperate interfaces file --- src/components/Link.tsx | 10 ++-------- src/components/interfaces.tsx | 8 ++++++++ src/data/hptimelinedata.tsx | 19 ++++--------------- 3 files changed, 14 insertions(+), 23 deletions(-) create mode 100644 src/components/interfaces.tsx diff --git a/src/components/Link.tsx b/src/components/Link.tsx index 345154ca..cec64603 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -1,4 +1,5 @@ import { useNavigation } from "../utils" +import { Ourlink } from "./interfaces"; export function TabScrollLink({tab, scrollId, num}:{tab: string, scrollId: string, num: string}){ const {goToPageWithTabAndScroll} = useNavigation(); @@ -7,14 +8,7 @@ export function TabScrollLink({tab, scrollId, num}:{tab: string, scrollId: strin ) } -interface Ourlink{ - path: string, - text: string, - scrollToId?: string, - tabId?: string, - subTabId?: string, - collapseId?: string -} + // 2^4 = 16 possible combinations diff --git a/src/components/interfaces.tsx b/src/components/interfaces.tsx new file mode 100644 index 00000000..53b9ceb7 --- /dev/null +++ b/src/components/interfaces.tsx @@ -0,0 +1,8 @@ +export interface Ourlink{ + path: string, + text: string, + scrollToId?: string, + tabId?: string, + subTabId?: string, + collapseId?: string +} \ No newline at end of file diff --git a/src/data/hptimelinedata.tsx b/src/data/hptimelinedata.tsx index d62320d1..728b7b4f 100644 --- a/src/data/hptimelinedata.tsx +++ b/src/data/hptimelinedata.tsx @@ -8,25 +8,14 @@ import RnhaleSources from "../sources/rnhale-sources"; import WischmeyerSources from "../sources/wimscheyer-sources"; import { useNavigation } from "../utils"; -function HPLinktoOtherHPTab({tab, text}:{tab: string, text: string}){ - const {goToPagesAndOpenTab} = useNavigation(); +function LinkFromTimeline({tab, text}:{tab: string, text: string}){ + const {goToPlace} = useNavigation(); return( - <a onClick={() => goToPagesAndOpenTab(tab, "")}> {text} </a> - ) -} -function HPgoToPageAndScroll({id, text, path}:{id: string, text: string, path: string}){ - const {goToPageAndScroll} = useNavigation(); - return( - <a onClick={() => goToPageAndScroll(id, path)}> {text} </a> - ) -} -function HPgoToPageWithTabAndScroll({id, text, path, scrollId}:{id: string, text: string, path: string, scrollId: string}){ - const {goToPageWithTabAndScroll} = useNavigation(); - return( - <a onClick={() => goToPageWithTabAndScroll({path: path, tabId: id, scrollToId: scrollId})}> {text} </a> + <a onClick={() => goToPlace(tab, "")}> {text} </a> ) } + /*function HPgoToPageAndOpenTab({id, text, path}:{id: string, text: string, path: string}){ const {goToPagesAndOpenTab} = useNavigation(); return( -- GitLab