Merge pull request #41 from xubaiw/navbar

Navbar
main
Henrik Böving 2022-02-23 19:18:22 +01:00 committed by GitHub
commit 58ce86f93d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -14,7 +14,7 @@ open Lean
open scoped DocGen4.Jsx open scoped DocGen4.Jsx
def moduleListFile (file : Name) : HtmlM Html := do def moduleListFile (file : Name) : HtmlM Html := do
pure <div "class"="nav_link" [if (← getCurrentName) == file then #[("visible", "")] else #[]]> pure <div «class»={if (← getCurrentName) == file then "nav_link visible" else "nav_link"}>
<a href={← moduleNameToLink file}>{file.toString}</a> <a href={← moduleNameToLink file}>{file.toString}</a>
</div> </div>
@ -29,7 +29,12 @@ partial def moduleListDir (h : Hierarchy) : HtmlM Html := do
pure pure
<details "class"="nav_sect" "data-path"={moduleLink} <details "class"="nav_sect" "data-path"={moduleLink}
[if (←getCurrentName).any (h.getName.isPrefixOf ·) then #[("open", "")] else #[]]> [if (←getCurrentName).any (h.getName.isPrefixOf ·) then #[("open", "")] else #[]]>
{Html.element "summary" true #[] #[<a "href"={← moduleNameToLink h.getName}>{h.getName.toString}</a>]} {
if (←getResult).moduleInfo.contains h.getName then
Html.element "summary" true #[] #[<a "href"={← moduleNameToLink h.getName}>{h.getName.toString}</a>]
else
<summary>{h.getName.toString}</summary>
}
[dirNodes] [dirNodes]
[fileNodes] [fileNodes]
</details> </details>

View File

@ -273,10 +273,15 @@ nav {
margin-top: 1ex; margin-top: 1ex;
} }
.nav details, .nav_link { .nav details > * {
padding-left: 2ex; padding-left: 2ex;
} }
.nav summary {
cursor: pointer;
padding-left: 0;
}
.nav summary::marker { .nav summary::marker {
font-size: 85%; font-size: 85%;
} }
@ -294,6 +299,10 @@ nav {
overflow-wrap: break-word; overflow-wrap: break-word;
} }
.nav_link {
overflow-wrap: break-word;
}
.decl > div, .mod_doc { .decl > div, .mod_doc {
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;