Skip to content

Commit

Permalink
fix: issue asyncapi#2181 Links in tools section to specific category …
Browse files Browse the repository at this point in the history
…do not work
  • Loading branch information
aryanas159 committed Oct 1, 2023
1 parent 320ec58 commit 290f3f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions components/tools/ToolDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ export default function ToolDashboard() {
}, 1000);
}, []);

// useEffect to scroll particular div into view
useEffect(() => {
setTimeout(() => {
const path = router.asPath
const id = path.slice(path.indexOf("#") + 1).replace("%20", " ")
const element = document.getElementById(id)
if (element) {
element.scrollIntoView({ behavior: 'smooth', block: "nearest", inline: "nearest" })
}
}, 1000)
}, [])
// useEffect function to enable the close Category dropdown Modal feature when clicked outside of the modal
useEffect(() => {
const checkIfClickOutside = (e) => {
Expand Down
2 changes: 1 addition & 1 deletion components/tools/ToolsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function toolsList({ toolsData }) {
<div className="" data-testid="ToolsList-main" >
{Object.keys(toolsData).map((categoryName, index) => {
if(toolsData[categoryName].toolsList.length > 0) return (
<div className='my-8' key={index} id={categoryName}>
<div className='my-8' key={index} id={categoryName} style={{scrollMargin: "100px"}}>
<Heading typeStyle='heading-md-semibold' className='my-2' >
{categoryName}
</Heading>
Expand Down

0 comments on commit 290f3f6

Please sign in to comment.