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
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>
</div>
@ -29,7 +29,12 @@ partial def moduleListDir (h : Hierarchy) : HtmlM Html := do
pure
<details "class"="nav_sect" "data-path"={moduleLink}
[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]
[fileNodes]
</details>

View File

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