Skip to content

Commit

Permalink
docs[minor]: Hide prev/next buttons on how to and tutorials (#5425)
Browse files Browse the repository at this point in the history
* docs[minor]: Hide prev/next buttons on how to and tutorials

* chore: lint files

* chore: lint files
  • Loading branch information
bracesproul committed May 16, 2024
1 parent 06045b9 commit 0e49b19
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/core_docs/src/theme/DocPaginator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import DocPaginator from "@theme-original/DocPaginator";

const BLACKLISTED_PATHS = ["/docs/how_to/", "/docs/tutorials/"];

export default function DocPaginatorWrapper(props) {
const [shouldHide, setShouldHide] = React.useState(false);

React.useEffect(() => {
if (typeof window === "undefined") return;
const currentPath = window.location.pathname;
if (BLACKLISTED_PATHS.some((path) => currentPath.includes(path))) {
setShouldHide(true);
}
}, []);

if (!shouldHide) {
// eslint-disable-next-line react/jsx-props-no-spreading
return <DocPaginator {...props} />;
}
return null;
}

0 comments on commit 0e49b19

Please sign in to comment.