diff --git a/src/components/layout/RowAccordion/index.tsx b/src/components/layout/RowAccordion/index.tsx index 395319d..7507e73 100644 --- a/src/components/layout/RowAccordion/index.tsx +++ b/src/components/layout/RowAccordion/index.tsx @@ -45,8 +45,8 @@ export default function RowAccordion({ data, placement='bottom' }: Props) { } }, [isInView]); - const getToPath = (link: { text: string; path: string }) => { - return link.path.includes("{id}") ? link.path.replace("{id}", link.text) : link.path; + const getToPath = (link: { text: string; path: string }, index: number) => { + return link.path.includes("{id}") ? link.path.replace("{id}", index.toString()) : link.path; } return ( @@ -98,8 +98,8 @@ export default function RowAccordion({ data, placement='bottom' }: Props) { )} {item.links && (
- {item.links?.map((link) => ( - {link.text} + {item.links?.map((link, index) => ( + {link.text} ))}
)} diff --git a/src/components/layout/SwiperCardSection/index.tsx b/src/components/layout/SwiperCardSection/index.tsx index ac27de0..24bd245 100644 --- a/src/components/layout/SwiperCardSection/index.tsx +++ b/src/components/layout/SwiperCardSection/index.tsx @@ -33,14 +33,14 @@ export default function SwiperCardSection({ data, disableHover=false }: { data: useEffect(() => { if (hashId && data.cardItems && swiperRef) { - const index = data.cardItems.findIndex((item) => item.title === hashId); + const index = data.cardItems.findIndex((item, index) => index == parseInt(hashId)); if (index !== -1) { swiperRef.slideTo(index, 0); } } }, [hashId, data.cardItems, swiperRef]) return ( -
+
{activeIndex > 0 && ( diff --git a/src/components/layout/TopTabsSection/TopTabs.tsx b/src/components/layout/TopTabsSection/TopTabs.tsx index edf9fda..f072c6b 100644 --- a/src/components/layout/TopTabsSection/TopTabs.tsx +++ b/src/components/layout/TopTabsSection/TopTabs.tsx @@ -104,7 +104,6 @@ export default function TopTabs({ data, activeIndex, setActiveIndex, className } useEffect(() => { - console.log('locale', locale); updateIndicatorPosition(); }, [locale]); diff --git a/src/components/layout/TopTabsSection/index.tsx b/src/components/layout/TopTabsSection/index.tsx index 478bf0f..ac399d0 100644 --- a/src/components/layout/TopTabsSection/index.tsx +++ b/src/components/layout/TopTabsSection/index.tsx @@ -36,10 +36,9 @@ export default function TopTabsSection({ data, className }: { data: Data, classN const hash = location.hash; const hashId = decodeURIComponent(hash.replace('#', '')); const [activeIndex, setActiveIndex] = useState(0); - useEffect(() => { if (hashId && data.tabItems) { - const index = data.tabItems.findIndex((item) => item.tabName === hashId); + const index = data.tabItems.findIndex((item, index) => index === parseInt(hashId)); if (index !== -1) { setActiveIndex(index); } @@ -49,10 +48,10 @@ export default function TopTabsSection({ data, className }: { data: Data, classN const sideSlides = sideImageToSlides(data.tabItems[activeIndex]?.sideImage); return ( -
+