Skip to content

Commit 6abf596

Browse files
authored
Fix sidebar scroll and footer display (#1152)
* Set nav's bottom to make it scrollable again * Improve layout and navigation scroll behavior - Ensured the footer is part of the `nav` and sticks to the bottom by default, appearing at the bottom of the scroll when content overflows. - Applied flexbox layout to `nav` and `main` to manage space distribution.
1 parent d711a2c commit 6abf596

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

lib/rdoc/generator/darkfish.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,6 @@ def assemble_template body_file
677677
return body if body =~ /<html/
678678

679679
head_file = @template_dir + '_head.rhtml'
680-
footer_file = @template_dir + '_footer.rhtml'
681680

682681
<<-TEMPLATE
683682
<!DOCTYPE html>
@@ -687,8 +686,6 @@ def assemble_template body_file
687686
#{head_file.read}
688687
689688
#{body}
690-
691-
#{footer_file.read}
692689
TEMPLATE
693690
end
694691

lib/rdoc/generator/template/darkfish/css/rdoc.css

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ body {
2424

2525
/* Layout */
2626
display: flex;
27-
flex-wrap: wrap;
27+
flex-direction: column;
28+
min-height: 100vh;
29+
margin: 0;
2830
}
2931

3032
body > :last-child {
@@ -209,16 +211,35 @@ nav {
209211
border-right: 1px solid #ccc;
210212
position: fixed;
211213
top: 0;
212-
overflow: auto;
214+
bottom: 0;
215+
overflow: hidden;
213216
z-index: 10;
214217

215218
/* Layout */
216219
width: var(--sidebar-width);
217220
min-height: 100vh;
218221
background: white;
222+
223+
display: flex;
224+
flex-direction: column;
225+
}
226+
227+
nav[hidden] {
228+
display: none;
229+
}
230+
231+
nav #project-metadata {
232+
overflow: auto; /* Make the content scrollable */
233+
flex: 1; /* Take up remaining space */
234+
}
235+
236+
nav footer {
237+
padding: 1em;
238+
border-top: 1px solid #ccc;
219239
}
220240

221241
main {
242+
flex: 1;
222243
display: block;
223244
margin: 3em auto 1em;
224245
padding: 0 1em; /* Add padding to keep space between main content and sidebar/right side of the screen */
@@ -728,8 +749,4 @@ pre {
728749
font-family: "Source Code Pro", Monaco, monospace;
729750
}
730751

731-
footer {
732-
z-index: 20;
733-
}
734-
735752
/* @end */

lib/rdoc/generator/template/darkfish/index.rhtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<%= render '_sidebar_pages.rhtml' %>
1313
<%= render '_sidebar_classes.rhtml' %>
1414
</div>
15+
16+
<%= render '_footer.rhtml' %>
1517
</nav>
1618

1719
<main role="main">

0 commit comments

Comments
 (0)