Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions templates/crate/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
{%- endblock header -%}

{%- block body -%}
<div class="container package-page-container">
<div class="container package-page-container small-bottom-pad">
<div class="pure-g">
<div id="side-menu" class="pure-u-1 {% if file_content %}pure-u-sm-7-24 pure-u-md-5-24{% endif %}">
<div id="side-menu" class="pure-u-1 {% if file_content %}pure-u-sm-7-24 pure-u-md-5-24 source-view{% endif %}">
<div class="pure-menu package-menu">
<ul class="pure-menu-list">
{# If we are displaying a file, we also add a button to hide the file sidebar #}
Expand Down
40 changes: 39 additions & 1 deletion templates/style/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,17 @@ div.package-sheet-container {
}
}

$sidebar-side-padding: 10px;

div.package-page-container {
padding-bottom: 50px;

&.small-bottom-pad {
padding-bottom: 30px;
}

div.package-menu {
padding: 0 10px;
padding: 0 $sidebar-side-padding;

li.pure-menu-heading {
font-size: 1.3em;
Expand Down Expand Up @@ -812,6 +818,32 @@ ul.pure-menu-list {
}
}

#side-menu.source-view {
position: relative;

.package-menu {
position: -webkit-sticky;
position: sticky;
top: $top-navbar-height;
overflow: auto;
max-height: calc(100vh - #{$top-navbar-height});
height: calc(100% - #{$top-navbar-height});

.pure-menu-list {
position: absolute;
top: 0;
max-height: 100vh;
height: 100%;
width: calc(100% - #{$sidebar-side-padding} * 2);
padding-top: 5px;

.pure-menu-item {
height: initial;
}
}
}
}

#side-menu.collapsed {
max-width: 46px;

Expand All @@ -834,6 +866,12 @@ ul.pure-menu-list {
#source-code {
pre {
margin-top: 0;
margin-bottom: 0;
height: 100%;

code {
height: 100%;
}
}

&.expanded {
Expand Down