-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b3a3fe
commit 4d1511a
Showing
144 changed files
with
2,828 additions
and
2,958 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,8 +90,6 @@ | |
}, | ||
"resolutions": { | ||
"postcss": "8.4.31", | ||
"@mdx-js/mdx": "3.0.1", | ||
"@mdx-js/react": "3.0.1", | ||
"esbuild": "0.20.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,41 @@ | ||
import clsx from "clsx"; | ||
import { ReactElement } from "react"; | ||
import { ReactElement, memo } from "react"; | ||
import { useShouldHideFromSsg } from "../contexts/navigation-context/useNavigationContext"; | ||
import { MdxContent } from "../mdx/MdxContent"; | ||
import { ResolvedPageMetadata } from "../resolver/types"; | ||
import { useApiPageCenterElement } from "./useApiPageCenterElement"; | ||
|
||
export const ApiSectionMarkdownPage = ({ | ||
page, | ||
hideBottomSeparator, | ||
}: { | ||
page: ResolvedPageMetadata; | ||
hideBottomSeparator: boolean; | ||
}): ReactElement | null => { | ||
const slug = page.slug; | ||
export const ApiSectionMarkdownPage = memo( | ||
({ | ||
page, | ||
hideBottomSeparator, | ||
}: { | ||
page: ResolvedPageMetadata; | ||
hideBottomSeparator: boolean; | ||
}): ReactElement | null => { | ||
const slug = page.slug; | ||
|
||
const { setTargetRef } = useApiPageCenterElement({ slug }); | ||
const { setTargetRef } = useApiPageCenterElement({ slug }); | ||
|
||
// TODO: this is a temporary fix to only SSG the content that is requested by the requested route. | ||
// - webcrawlers will accurately determine the canonical URL (right now every page "returns" the same full-length content) | ||
// - this allows us to render the static page before hydrating, preventing layout-shift caused by the navigation context. | ||
if (useShouldHideFromSsg(slug)) { | ||
return null; | ||
} | ||
// TODO: this is a temporary fix to only SSG the content that is requested by the requested route. | ||
// - webcrawlers will accurately determine the canonical URL (right now every page "returns" the same full-length content) | ||
// - this allows us to render the static page before hydrating, preventing layout-shift caused by the navigation context. | ||
if (useShouldHideFromSsg(slug)) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div | ||
className={clsx("scroll-mt-header-height-padded", { | ||
"border-default border-b mb-px": !hideBottomSeparator, | ||
})} | ||
ref={setTargetRef} | ||
data-route={`/${slug}`} | ||
> | ||
<MdxContent mdx={page.markdown} /> | ||
</div> | ||
); | ||
}; | ||
return ( | ||
<div | ||
className={clsx("scroll-mt-content", { | ||
"border-default border-b mb-px": !hideBottomSeparator, | ||
})} | ||
ref={setTargetRef} | ||
data-route={`/${slug}`} | ||
> | ||
<MdxContent mdx={page.markdown} /> | ||
</div> | ||
); | ||
}, | ||
); | ||
|
||
ApiSectionMarkdownPage.displayName = "ApiSectionMarkdownPage"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.