1
0
mirror of synced 2026-01-10 18:02:53 -05:00

Merge pull request #17547 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2022-05-02 15:55:01 -05:00
committed by GitHub
2 changed files with 27 additions and 25 deletions

View File

@@ -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

View File

@@ -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}