docs: fix weird scroll behavior (#11668)
This commit is contained in:
@@ -10,7 +10,7 @@ export const H1 = ({ className, ...props }: H1Props) => {
|
||||
<h1
|
||||
className={clsx(
|
||||
"h1-docs [&_code]:!h1-docs [&_code]:!font-mono mb-docs_1 text-medusa-fg-base",
|
||||
props.id && "scroll-m-56",
|
||||
props.id && "scroll-m-docs_7",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import clsx from "clsx"
|
||||
import React from "react"
|
||||
import { CopyButton, Link } from "@/components"
|
||||
import { useHeadingUrl } from "../../.."
|
||||
import { useHeadingUrl, useLayout } from "../../.."
|
||||
|
||||
type H2Props = React.HTMLAttributes<HTMLHeadingElement> & {
|
||||
id?: string
|
||||
@@ -11,6 +11,8 @@ type H2Props = React.HTMLAttributes<HTMLHeadingElement> & {
|
||||
}
|
||||
|
||||
export const H2 = ({ className, children, passRef, ...props }: H2Props) => {
|
||||
const { showCollapsedNavbar } = useLayout()
|
||||
|
||||
const copyText = useHeadingUrl({
|
||||
id: props.id || "",
|
||||
})
|
||||
@@ -18,7 +20,11 @@ export const H2 = ({ className, children, passRef, ...props }: H2Props) => {
|
||||
<h2
|
||||
className={clsx(
|
||||
"h2-docs [&_code]:!h2-docs [&_code]:!font-mono mb-docs_1 mt-docs_2 text-medusa-fg-base",
|
||||
props.id && "group/h2 scroll-m-56",
|
||||
props.id && [
|
||||
"group/h2",
|
||||
showCollapsedNavbar && "scroll-m-docs_7",
|
||||
!showCollapsedNavbar && "scroll-m-56",
|
||||
],
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -3,19 +3,24 @@
|
||||
import clsx from "clsx"
|
||||
import React from "react"
|
||||
import { CopyButton, Link } from "@/components"
|
||||
import { useHeadingUrl } from "../../.."
|
||||
import { useHeadingUrl, useLayout } from "../../.."
|
||||
|
||||
type H3Props = React.HTMLAttributes<HTMLHeadingElement> & {
|
||||
id?: string
|
||||
}
|
||||
|
||||
export const H3 = ({ className, children, ...props }: H3Props) => {
|
||||
const { showCollapsedNavbar } = useLayout()
|
||||
const copyText = useHeadingUrl({ id: props.id || "" })
|
||||
return (
|
||||
<h3
|
||||
className={clsx(
|
||||
"h3-docs [&_code]:!h3-docs [&_code]:!font-mono my-docs_1 text-medusa-fg-base",
|
||||
props.id && "group/h3 scroll-m-56",
|
||||
props.id && [
|
||||
"group/h3",
|
||||
showCollapsedNavbar && "scroll-m-docs_7",
|
||||
!showCollapsedNavbar && "scroll-m-56",
|
||||
],
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
Reference in New Issue
Block a user