Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nx-dev): hide toc on reference pages #18136

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions nx-dev/feature-doc-viewer/src/lib/doc-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export function DocViewer({
relatedDocuments: RelatedDocument[];
}): JSX.Element {
const router = useRouter();
const isIntroPage =
const hideTableOfContent =
router.asPath.includes('/getting-started/intro') ||
router.asPath.includes('/plugins/intro/getting-started');
router.asPath.includes('/plugins/intro/getting-started') ||
router.asPath.includes('/packages/devkit') ||
router.asPath.includes('/reference/glossary');
const ref = useRef<HTMLDivElement | null>(null);

const { metadata, node, treeNode } = renderMarkdown(
Expand Down Expand Up @@ -92,12 +94,12 @@ export function DocViewer({
data-document="main"
className={cx(
'prose prose-slate dark:prose-invert w-full max-w-none 2xl:max-w-4xl',
{ 'xl:max-w-2xl': !isIntroPage }
{ 'xl:max-w-2xl': !hideTableOfContent }
)}
>
{vm.content}
</div>
{!isIntroPage && (
{!hideTableOfContent && (
<div
className={cx(
'fixed top-36 right-[max(2rem,calc(50%-55rem))] z-20 hidden w-60 overflow-y-auto bg-white py-10 text-sm dark:bg-slate-900 xl:block'
Expand Down