Skip to content

Commit

Permalink
Move Hamburger to left in mobile layout (#2076)
Browse files Browse the repository at this point in the history
  • Loading branch information
inkydragon authored Mar 27, 2023
1 parent bafceba commit 791b3ec
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- jquery has been updated from `v3.6.0` to `v3.6.4`.
- MathJax 2 has been updated from `v2.7.7` to `v2.7.9`.

* Move the mobile layout sidebar toggle (hamburger) from the right side to the left side. (#1312, #2076)

### Fixed

* Documenter now generates the correct source URLs for docstrings from other packages when the `repo` argument to `makedocs` is set (note: the source links to such docstrings only work if the external package is cloned from GitHub and added as a dev-dependency). However, this change **breaks** the case where the `repo` argument is used to override the main package/repository URL, assuming the repository is cloned from GitHub. (#1808)
Expand Down
16 changes: 12 additions & 4 deletions assets/html/scss/documenter/layout/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,29 @@
display: flex;
.breadcrumb {
flex-grow: 1;
padding-left: 0.5rem;
}

.docs-left {
// Manually align with the center line of H
padding-top: 2px;
padding-right: 0.5rem;
.docs-sidebar-button {
display: inline-block;
font-size: 1.5rem;
}
}

.docs-right {
display: flex;
.docs-icon, .docs-label, .docs-sidebar-button {
.docs-icon, .docs-label {
display: inline-block;
}
white-space: nowrap;
.docs-label {
padding: 0;
margin-left: 0.3em;
}
.docs-sidebar-button {
font-size: 1.5rem;
}
.docs-navbar-link {
margin: auto 0.5rem auto 0.5rem;
}
Expand Down
13 changes: 9 additions & 4 deletions assets/html/themes/documenter-dark.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions assets/html/themes/documenter-light.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions src/html/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,13 @@ end

function render_navbar(ctx, navnode, edit_page_link::Bool)
@tags div header nav ul li a span

navbar_left = div[".docs-left"]
# Hamburger on mobile
push!(navbar_left.nodes, a[
"#documenter-sidebar-button.docs-sidebar-button.docs-navbar-link.fa-solid.fa-bars.is-hidden-desktop",
:href => "#",
])

# The breadcrumb (navigation links on top)
navpath = Documenter.navpath(navnode)
Expand Down Expand Up @@ -1218,14 +1225,8 @@ function render_navbar(ctx, navnode, edit_page_link::Bool)
:href => "#", :title => "Settings",
])

# Hamburger on mobile
push!(navbar_right.nodes, a[
"#documenter-sidebar-button.docs-sidebar-button.docs-navbar-link.fa-solid.fa-bars.is-hidden-desktop",
:href => "#",
])

# Construct the main <header> node that should be the first element in div.docs-main
header[".docs-navbar"](breadcrumb, navbar_right)
header[".docs-navbar"](navbar_left, breadcrumb, navbar_right)
end

"""
Expand Down

0 comments on commit 791b3ec

Please sign in to comment.