Skip to content

Commit e02bbd4

Browse files
authored
Merge pull request #4242 from thiha-min-thant/navbar-sidebar-issues
📖 Resolve navigation bar CSS issue and sidebar toggle functionality.
2 parents 81ce166 + 33083b2 commit e02bbd4

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

docs/book/install-and-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ esac
6363

6464
# grab mdbook
6565
# we hardcode linux/amd64 since rust uses a different naming scheme and it's a pain to tran
66-
echo "downloading mdBook-v0.4.34-${arch}-${target}.${ext}"
66+
echo "downloading mdBook-v0.4.40-${arch}-${target}.${ext}"
6767
set -x
68-
curl -sL -o /tmp/mdbook.${ext} https://github.com/rust-lang/mdBook/releases/download/v0.4.34/mdBook-v0.4.34-${arch}-${target}.${ext}
68+
curl -sL -o /tmp/mdbook.${ext} https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdBook-v0.4.40-${arch}-${target}.${ext}
6969
${cmd} /tmp/mdbook.${ext}
7070
chmod +x /tmp/mdbook
7171

docs/book/theme/css/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
.menu-title img {
22
vertical-align: bottom;
33
}
4+
5+
#sidebar-toggle-anchor:checked .page-wrapper {
6+
margin-inline-start: calc(var(--sidebar-width) + var(--sidebar-resize-indicator-width));
7+
}

docs/book/theme/index.hbs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,17 @@
8383
html.classList.add('js');
8484
</script>
8585

86+
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
8687
<!-- Hide / unhide sidebar before it is displayed -->
8788
<script type="text/javascript">
8889
var html = document.querySelector('html');
8990
var sidebar = 'hidden';
91+
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
9092
if (document.body.clientWidth >= 1080) {
9193
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
9294
sidebar = sidebar || 'visible';
9395
}
96+
sidebar_toggle.checked = sidebar === 'visible';
9497
html.classList.remove('sidebar-visible');
9598
html.classList.add("sidebar-" + sidebar);
9699
</script>
@@ -108,9 +111,9 @@
108111
<div id="menu-bar-hover-placeholder"></div>
109112
<div id="menu-bar" class="menu-bar sticky bordered">
110113
<div class="left-buttons">
111-
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
114+
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
112115
<i class="fa fa-bars"></i>
113-
</button>
116+
</label>
114117
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
115118
<i class="fa fa-paint-brush"></i>
116119
</button>

0 commit comments

Comments
 (0)