Skip to content

Commit 05bb0b4

Browse files
committed
fix non doc page mobile nav
1 parent 82f90fa commit 05bb0b4

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

app/routes/MdxRoute.res

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ let blogPosts = async () => {
8484
let manualTableOfContents = async () => {
8585
let groups =
8686
(await allMdx())
87-
->Array.map(item => {
88-
Console.log(item.path)
89-
item
90-
})
9187
->filterMdxPages("docs/manual")
9288
->groupBySection
9389
->Dict.mapValues(values => values->sortSection->convertToNavItems("/docs/manual"))
@@ -285,8 +281,6 @@ let default = () => {
285281

286282
let {entries, categories, title} = loaderData
287283

288-
Console.log2("Rendering MdxRoute for path:", attributes)
289-
290284
<>
291285
{if (pathname :> string) == "/docs/manual/api" {
292286
<>

src/layouts/CommunityLayout.res

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
let make = (~children, ~categories, ~entries) => {
33
let {pathname} = ReactRouter.useLocation()
44

5-
Console.log((pathname :> string)->String.split("/"))
6-
75
let activePage =
86
(pathname :> string)
97
->String.split("/")

src/layouts/SidebarLayout.res

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ let scrollToAnchor = (hash: string) => {
1010
WebAPI.Document.getElementById(document, hash)->WebAPI.Element.scrollIntoView_alignToTop
1111
}
1212

13+
let isDocRoute = (~route: Path.t) => {
14+
let route = (route :> string)
15+
route->String.includes("/docs/") || route->String.includes("/syntax-lookup")
16+
}
17+
1318
module Toc = {
1419
type raw = Dict.t<{
1520
"title": string,
@@ -334,7 +339,9 @@ let make = (
334339
//width of the right content part
335340
<div
336341
id="mobile-navbar"
337-
className={"z-10 fixed border-b shadow top-[112px] left-0 pl-4 bg-white w-full py-4 md:relative md:border-none md:shadow-none md:p-0 md:top-auto flex items-center transition duration-300 ease-out group-[.nav-disappear]:-translate-y-64 md:group-[.nav-disappear]:-translate-y-0"}
342+
className={`z-10 fixed border-b shadow ${isDocRoute(~route=pathname)
343+
? "top-[112px]"
344+
: "top-[64px]"} left-0 pl-4 bg-white w-full py-4 md:relative md:border-none md:shadow-none md:p-0 md:top-auto flex items-center transition duration-300 ease-out group-[.nav-disappear]:-translate-y-64 md:group-[.nav-disappear]:-translate-y-0`}
338345
>
339346
<MobileDrawerButton hidden=isNavOpen onClick={handleDrawerButtonClick} />
340347
<div

0 commit comments

Comments
 (0)