diff --git a/components/Docs/Docs.module.scss b/components/Docs/Docs.module.scss index 761410bf..2c491153 100644 --- a/components/Docs/Docs.module.scss +++ b/components/Docs/Docs.module.scss @@ -45,7 +45,7 @@ flex-direction: column; flex: 0 0 300px; position: sticky; - height: calc(100vh - 54px); + height: 100vh; top: 0px; z-index: 5; max-width: 300px; @@ -225,7 +225,6 @@ h4, h5 { scroll-margin-top: var(--size-large); - margin: var(--size-large) 0 !important; &:hover { text-decoration: underline; @@ -1009,7 +1008,7 @@ h5:hover .headingCopyIcon { flex: 0 0 auto; height: auto; border-bottom: 1px solid var(--divider-on-dark); - padding: var(--size-large) var(--size-large); + gap: 8px; position: relative; max-width: none; top: 0; @@ -1029,13 +1028,15 @@ h5:hover .headingCopyIcon { } .leftInner { - padding: 0; + padding: 8px; } .tocMenu { display: flex; flex-direction: column; align-items: flex-start; + padding: 8px; + margin: 0 8px; .tocMenuLabel { display: flex; @@ -1092,10 +1093,6 @@ h5:hover .headingCopyIcon { word-break: break-word; } - .leftSection { - top: 0; - } - .centerSection { padding: var(--size-large) var(--size-medium) var(--size-4xLarge); } diff --git a/components/Docs/DocsTypographyRenderer/DocsTypographyRenderer.tsx b/components/Docs/DocsTypographyRenderer/DocsTypographyRenderer.tsx index 0e654df0..cf0db92c 100644 --- a/components/Docs/DocsTypographyRenderer/DocsTypographyRenderer.tsx +++ b/components/Docs/DocsTypographyRenderer/DocsTypographyRenderer.tsx @@ -1,12 +1,12 @@ -import styles from '../Docs.module.scss' +import classNames from 'classnames' +import Link from 'next/link' import { useRouter } from 'next/router' +import { createElement } from 'react' +import { BiLink } from 'react-icons/bi' import { HeroVideo } from '../../Home/HeroVideo/HeroVideo' import { Callout } from '../Callout/Callout' +import styles from '../Docs.module.scss' import { HighlightCodeBlock } from '../HighlightCodeBlock/HighlightCodeBlock' -import Link from 'next/link' -import { BiLink } from 'react-icons/bi' -import { createElement } from 'react' -import classNames from 'classnames' const getIdFromHTMLHeaderProps = (props: any) => { return props?.children @@ -34,6 +34,7 @@ export const generateIdString = (str: string) => { .trim() .split(' ') .join('-') + .toLowerCase() } const copyHeadingIcon = (index: number) => { diff --git a/pages/docs/[[...doc]].tsx b/pages/docs/[[...doc]].tsx index 98f0434c..9a921cc5 100644 --- a/pages/docs/[[...doc]].tsx +++ b/pages/docs/[[...doc]].tsx @@ -105,7 +105,7 @@ const useIntersectionObserver = (setActiveId: (s: string) => void) => { } const observer = new IntersectionObserver(callback, { - rootMargin: '0px 0px -40% 0px', + rootMargin: '-45% 0px', }) const headingElements = Array.from(document.querySelectorAll('h4, h5')) @@ -435,7 +435,11 @@ const PageRightBar = ({ relativePath }: { title: string; relativePath: string }) Community / Support - + Suggest Edits? @@ -465,6 +469,8 @@ const PageRightBar = ({ relativePath }: { title: string; relativePath: string }) e.preventDefault() document.querySelector(`#${heading.id}`)?.scrollIntoView({ behavior: 'smooth', + block: 'center', + inline: 'center', }) const basePath = router.asPath.split('#')[0] const newUrl = `${basePath}#${heading.id}` @@ -496,11 +502,13 @@ const TableOfContents = ({ docPaths, openParent, openTopLevel = false, + onNavigate, }: { toc: TocEntry openParent: boolean openTopLevel?: boolean docPaths: DocPath[] + onNavigate?: () => void }) => { const hasChildren = !!toc?.children.length @@ -513,7 +521,8 @@ const TableOfContents = ({ setIsCurrentPage(currentPage === window.location.pathname) const isParentOfCurrentPage = window.location.pathname.includes(docPaths[toc.docPathId || 0]?.simple_path) setOpen((prevOpenState) => prevOpenState || isParentOfCurrentPage) - }, [docPaths, toc.docPathId]) + onNavigate?.() + }, [docPaths, toc.docPathId, onNavigate]) return (
@@ -720,6 +729,7 @@ const DocPage = ({ docPaths={docOptions} openParent={false} openTopLevel={false} + onNavigate={() => setOpen(false)} /> )) )} @@ -771,7 +781,15 @@ const DocPage = ({ h1: (props) =>

, h2: (props) => { if (props.children && typeof props.children === 'string') { - return

+ const id = generateIdString(props.children as string) + return ( + +
+ + ) } return <> }, @@ -918,28 +936,15 @@ const QuickStart = (content: { content: QuickStartContent }) => { {c.entries.map((step: QuickStartStep, i: number) => { if (step.hidden) return null return ( -
-
-
+
+
+
{i + 1}
-
+
-
-
+
+
{step.title} @@ -959,7 +964,7 @@ const QuickStart = (content: { content: QuickStartContent }) => { {step.content}
-
+
{step.code && ( {
-

+

The open source, fullstack
Monitoring Platform.

-
+