Skip to content

Commit

Permalink
Scroll to products if #products in course detail url
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielKerekes committed Oct 31, 2023
1 parent 09ad907 commit d2e86c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/kurzy/[slug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,14 @@ const CourseDetailContent = ({
}
}

setHasProductsInLocation(window.location.hash === '#products')

window.addEventListener('hashchange', handleHashChange)

return () => {
window.removeEventListener('hashchange', handleHashChange)
}
}, [])
}, [setHasProductsInLocation])

useEffect(() => {
if (hasProductsInLocation && courseProductsRef.current) {
Expand Down

0 comments on commit d2e86c8

Please sign in to comment.