Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add offline docs #8527

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

Merged
merged 13 commits into from
Jul 19, 2023
Prev Previous commit
Next Next commit
Remove app from docs folder
  • Loading branch information
BrunoQuaresma committed Jul 19, 2023
commit 42e8b8c4467eec4ece909416731c6a307f724fbd
Original file line number Diff line number Diff line change
Expand Up @@ -239,24 +239,23 @@ const SidebarNavItem: React.FC<{ item: NavItem; nav: Nav }> = ({
nav,
}) => {
const router = useRouter()
let isActive = router.asPath.startsWith(`/docs/${item.path}`)
let isActive = router.asPath.startsWith(`/${item.path}`)

// Special case to handle the home path
if (item.path === "") {
isActive = router.asPath === "/docs/"
isActive = router.asPath === "/"

// Special case to handle the home path children
const homeNav = nav.find((navItem) => navItem.path === "") as NavItem
const homeNavPaths =
homeNav.children?.map((item) => `/docs/${item.path}/`) ?? []
const homeNavPaths = homeNav.children?.map((item) => `/${item.path}/`) ?? []
if (homeNavPaths.includes(router.asPath)) {
isActive = true
}
}

return (
<Box>
<NextLink href={"/docs/" + item.path} passHref>
<NextLink href={"/" + item.path} passHref>
<Link
fontWeight={isActive ? 600 : 400}
color={isActive ? "gray.900" : "gray.700"}
Expand Down