Skip to content

Commit

Permalink
feat: optimize left menu usage (#2094)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidChan3000 authored Jun 16, 2022
1 parent 9ddd708 commit 645f1e7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
21 changes: 21 additions & 0 deletions docs/static/css/theme-white.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ header .select-style select{
z-index: 2;
}

#sidebar .leftMenu{
overflow-y: auto;
}

#header-wrapper{
position:sticky;
background-color: #fff;
Expand Down Expand Up @@ -457,6 +461,7 @@ table td,p,code{
left:-300px;
width: 300px;
padding-left: 16px;
background-color: #fff;
}

.sidebar-hidden #body{
Expand All @@ -474,6 +479,22 @@ table td,p,code{
}
.icon-3,.icon-2,.icon-1{display: none;}

.retro-theme #sidebar{
background-color: #F2EFDD;
}
.eyehelp-theme #sidebar{
background-color: #C7EBC9;
}
.haitian-theme #sidebar{
background-color: #E5EDFF;
}
.deep-theme #sidebar{
background-color: #15202F;
}
.dark-theme #sidebar{
background-color: #171717;
}

}

@keyframes mymove {
Expand Down
3 changes: 2 additions & 1 deletion docs/themes/hugo-theme-learn/layouts/partials/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</div>

<div class="highlightable">
<div class="leftMenu">
<ul class="topics">

{{if eq .Site.Params.ordersectionsby "title"}}
Expand All @@ -38,7 +39,7 @@ <h3>{{ if not $disableShortcutsTitle}}{{ T "Shortcuts-Title"}}{{ end }}</h3>
</ul>
</section>
{{end}}

</div>
<!-- {{ if or .Site.IsMultiLingual $showvisitedlinks }}
<section id="prefooter">
<hr/>
Expand Down
8 changes: 4 additions & 4 deletions docs/themes/hugo-theme-learn/static/js/learn.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function getScrollBarWidth() {
};

function setMenuHeight() {
$('#sidebar .highlightable').height($('#sidebar').innerHeight() - $('#header-wrapper').height() - 40);
$('#sidebar .highlightable').perfectScrollbar('update');
$('#sidebar .leftMenu').height($(window).innerHeight() - $('#header-wrapper').height() - 240);
$('#sidebar .leftMenu').perfectScrollbar('update');
}

function fallbackMessage(action) {
Expand All @@ -49,7 +49,7 @@ function fallbackMessage(action) {

// for the window resize
$(window).resize(function() {
// setMenuHeight();
setMenuHeight();
});

// debouncing function from John Hann
Expand Down Expand Up @@ -91,7 +91,7 @@ jQuery(document).ready(function() {

var sidebarStatus = searchStatus = 'open';
$('#sidebar .highlightable').perfectScrollbar();
// setMenuHeight();
setMenuHeight();

jQuery('#overlay').on('click', function() {
jQuery(document.body).toggleClass('sidebar-hidden');
Expand Down

0 comments on commit 645f1e7

Please sign in to comment.