Skip to content

Commit 290f3f6

Browse files
committed
fix: issue asyncapi#2181 Links in tools section to specific category do not work
1 parent 320ec58 commit 290f3f6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

components/tools/ToolDashboard.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ export default function ToolDashboard() {
4848
}, 1000);
4949
}, []);
5050

51+
// useEffect to scroll particular div into view
52+
useEffect(() => {
53+
setTimeout(() => {
54+
const path = router.asPath
55+
const id = path.slice(path.indexOf("#") + 1).replace("%20", " ")
56+
const element = document.getElementById(id)
57+
if (element) {
58+
element.scrollIntoView({ behavior: 'smooth', block: "nearest", inline: "nearest" })
59+
}
60+
}, 1000)
61+
}, [])
5162
// useEffect function to enable the close Category dropdown Modal feature when clicked outside of the modal
5263
useEffect(() => {
5364
const checkIfClickOutside = (e) => {

components/tools/ToolsList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default function toolsList({ toolsData }) {
66
<div className="" data-testid="ToolsList-main" >
77
{Object.keys(toolsData).map((categoryName, index) => {
88
if(toolsData[categoryName].toolsList.length > 0) return (
9-
<div className='my-8' key={index} id={categoryName}>
9+
<div className='my-8' key={index} id={categoryName} style={{scrollMargin: "100px"}}>
1010
<Heading typeStyle='heading-md-semibold' className='my-2' >
1111
{categoryName}
1212
</Heading>

0 commit comments

Comments
 (0)