Skip to content

Commit

Permalink
Add information on how crate sizes are computed
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 4, 2024
1 parent 33da02b commit d046032
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 8 additions & 2 deletions templates/crate/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@
{%- if let Some(source_size) = source_size -%}
<li class="pure-menu-heading">Size</li>
<li class="pure-menu-item">
<span class="documented-info">Source code size: {{(*source_size)|filesizeformat}}</span>
<span class="documented-info">Source code size: {{(*source_size)|filesizeformat}} <span class="size" tabindex=0>
{{- crate::icons::IconCircleInfo.render_solid(false, false, "") -}}
<span class="info">This is the summed size of all downloaded crates.io package files</span>
</span>
</li>
{%- if let Some(doc_size) = documentation_size -%}
<li class="pure-menu-item">
<span class="documented-info">Documentation size: {{(*doc_size)|filesizeformat}}</span>
<span class="documented-info">Documentation size: {{(*doc_size)|filesizeformat}} <span class="size" tabindex=0>
{{- crate::icons::IconCircleInfo.render_solid(false, false, "") -}}
<span class="info">This is the summed size of all files generated by rustdoc</span>
</span>
</li>
{%- endif -%}
{%- endif -%}
Expand Down
14 changes: 14 additions & 0 deletions templates/style/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,20 @@ div.package-page-container {
width: 100%;
}

.documented-info .size .info {
display: none;
position: absolute;
top: 90%;
background: var(--color-background-code);
z-index: 1;
border: 1px solid var(--color-menu-border);
}

.documented-info .size:hover .info,
.documented-info .size:focus .info {
display: block;
}

li.pure-menu-heading:first-child {
margin-top: 0;
}
Expand Down

0 comments on commit d046032

Please sign in to comment.