@@ -65,31 +65,33 @@ export const RestCollapsibleSection = (props: SectionProps) => {
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.target.id) {
|
||||
const anchor = '#' + entry.target.id.split('--')[0]
|
||||
if (entry.isIntersecting === true) setVisibleAnchor(anchor)
|
||||
} else if (router.asPath.includes('#')) {
|
||||
setVisibleAnchor('#' + router.asPath.split('#')[1])
|
||||
} else {
|
||||
setVisibleAnchor('')
|
||||
}
|
||||
})
|
||||
},
|
||||
{ rootMargin: '0px 0px -85% 0px' }
|
||||
)
|
||||
// TODO: When we add the ## About the {title} API to each operation
|
||||
// we can remove the h2 here
|
||||
const headingsList = Array.from(document.querySelectorAll('h2, h3'))
|
||||
if (!router.asPath.includes('guides') && !router.asPath.includes('overview')) {
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.target.id) {
|
||||
const anchor = '#' + entry.target.id.split('--')[0]
|
||||
if (entry.isIntersecting === true) setVisibleAnchor(anchor)
|
||||
} else if (router.asPath.includes('#')) {
|
||||
setVisibleAnchor('#' + router.asPath.split('#')[1])
|
||||
} else {
|
||||
setVisibleAnchor('')
|
||||
}
|
||||
})
|
||||
},
|
||||
{ rootMargin: '0px 0px -85% 0px' }
|
||||
)
|
||||
// TODO: When we add the ## About the {title} API to each operation
|
||||
// we can remove the h2 here
|
||||
const headingsList = Array.from(document.querySelectorAll('h2, h3'))
|
||||
|
||||
headingsList.forEach((heading) => {
|
||||
observer.observe(heading)
|
||||
})
|
||||
headingsList.forEach((heading) => {
|
||||
observer.observe(heading)
|
||||
})
|
||||
|
||||
return () => {
|
||||
observer.disconnect()
|
||||
return () => {
|
||||
observer.disconnect()
|
||||
}
|
||||
}
|
||||
}, [miniTocItems])
|
||||
// This wrapper solves the issue of having standalone categories not
|
||||
|
||||
@@ -44,8 +44,8 @@ export default function Category({ mainContext, enabledForApps, articleContext }
|
||||
</h3>
|
||||
)}
|
||||
<ul>
|
||||
{operations.map((operation) => (
|
||||
<li key={`enabledAppOperation-${operation.slug}`}>
|
||||
{operations.map((operation, index) => (
|
||||
<li key={`enabledAppOperation-${operation.slug}-${index}`}>
|
||||
<Link href={`/${locale}/rest/reference/${category}#${operation.slug}`}>
|
||||
<code>
|
||||
<span className="text-uppercase">{operation.verb}</span> {operation.requestPath}
|
||||
|
||||
Reference in New Issue
Block a user