diff --git a/src/SyntaxLookup.res b/src/SyntaxLookup.res index f98e9f76d..2f14c9525 100644 --- a/src/SyntaxLookup.res +++ b/src/SyntaxLookup.res @@ -374,7 +374,7 @@ let default = (props: props) => {
-
+
content
diff --git a/src/components/Navigation.res b/src/components/Navigation.res index d75624361..48bfb3863 100644 --- a/src/components/Navigation.res +++ b/src/components/Navigation.res @@ -1,6 +1,6 @@ module Link = Next.Link -let link = "no-underline block hover:cursor-pointer hover:text-fire-30 text-gray-40 mb-px" +let link = "no-underline block hover:cursor-pointer hover:text-fire-30 mb-px" let activeLink = "font-medium text-fire-30 border-b border-fire" let linkOrActiveLink = (~target, ~route) => target === route ? activeLink : link @@ -8,16 +8,28 @@ let linkOrActiveLink = (~target, ~route) => target === route ? activeLink : link let linkOrActiveLinkSubroute = (~target, ~route) => String.startsWith(route, target) ? activeLink : link -let isActiveLink = (~route: string, ~href: string) => { - route == href ? activeLink : link +let isActiveLink = (~includes: string, ~excludes: option=?, ~route: string) => { + // includes means we want the lnk to be active if it contains the expected text + let includes = route->String.includes(includes) + // excludes allows us to not have links be active even if they do have the includes text + let excludes = switch excludes { + | Some(excludes) => route->String.includes(excludes) + | None => false + } + includes && !excludes ? activeLink : link } +let isDocRoute = (~route) => + route->String.includes("/docs/") || route->String.includes("/syntax-lookup") + +let isDocRouteActive = (~route) => isDocRoute(~route) ? activeLink : link + module MobileNav = { @react.component let make = (~route: string) => { - let base = "font-normal mx-4 py-5 text-gray-20 border-b border-gray-80" + let base = "font-normal mx-4 py-5 text-gray-40 border-b border-gray-80" let extLink = "block hover:cursor-pointer hover:text-white text-gray-60" -
+
  • @@ -73,98 +85,117 @@ let make = (~fixed=true, ~isOverlayOpen: bool, ~setOverlayOpen: (bool => bool) = let fixedNav = fixed ? "fixed top-0" : "relative" <> - + // This is a subnav for documentation pages + {isDocRoute(~route) + ? + : React.null} + } diff --git a/src/layouts/SidebarLayout.res b/src/layouts/SidebarLayout.res index bafdd84ca..96fc3e69c 100644 --- a/src/layouts/SidebarLayout.res +++ b/src/layouts/SidebarLayout.res @@ -138,14 +138,15 @@ module Sidebar = { id="sidebar" className={( isOpen ? "fixed w-full left-0 h-full z-20 min-w-320" : "hidden " - ) ++ " md:block md:w-48 md:-ml-4 lg:w-1/5 md:h-auto md:relative overflow-y-visible bg-white"}> + ) ++ " overflow-x-hidden md:block md:w-48 md:-ml-4 lg:w-1/5 md:h-auto md:relative overflow-y-visible bg-white"}>