Hide Crate Version on narrow Screens

This commit is contained in:
Stefan Schindler 2021-06-16 22:24:02 +02:00
parent e2efcf10de
commit cc9ef7d8a8
4 changed files with 21 additions and 6 deletions

View File

@ -365,7 +365,6 @@ def check_tree_attr(tree, path, attr, pat, regexp):
def check_tree_text(tree, path, pat, regexp):
path = normalize_xpath(path)
print("normalize_xpath -> {}".format(path))
ret = False
try:
for e in tree.findall(path):

View File

@ -1694,6 +1694,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) {
write!(
buffer,
"<div class=\"block version\">\
<div class=\"narrow-helper\"></div>
<p>Version {}</p>\
</div>",
Escape(version),

View File

@ -329,7 +329,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
"<item-left class=\"{stab}{add}import-item\">\
<code>{vis}{imp}</code>\
</item-left>\
<item-right class=\"docblock-short\">{stab_tags}</item-right>\n",
<item-right class=\"docblock-short\">{stab_tags}</item-right>",
stab = stab.unwrap_or_default(),
add = add,
vis = myitem.visibility.print_with_space(myitem.def_id, cx),
@ -361,7 +361,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
"<item-left class=\"{stab}{add}module-item\">\
<a class=\"{class}\" href=\"{href}\" \
title=\"{title}\">{name}</a>{unsafety_flag}</item-left>\
<item-right class=\"docblock-short\">{stab_tags}{docs}</item-right>\n",
<item-right class=\"docblock-short\">{stab_tags}{docs}</item-right>",
name = *myitem.name.as_ref().unwrap(),
stab_tags = extra_info_tags(myitem, item, cx.tcx()),
docs = MarkdownSummaryLine(&doc_value, &myitem.links(cx)).into_string(),
@ -381,7 +381,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
}
if curty.is_some() {
w.write_str("</item-table>\n");
w.write_str("</item-table>");
}
}

View File

@ -1619,9 +1619,25 @@ details.undocumented[open] > summary::before {
}
.sidebar > .block.version {
overflow: hidden;
border-bottom: none;
margin-top: 12px;
margin-bottom: 0;
height: 100%;
padding-left: 12px;
}
.sidebar > .block.version > div.narrow-helper {
float: left;
width: 1px;
height: 100%;
}
.sidebar > .block.version > p {
/* hide Version text if too narrow */
margin: 0;
min-width: 55px;
/* vertically center */
display: flex;
align-items: center;
height: 100%;
}
nav.sub {
@ -1779,7 +1795,6 @@ details.undocumented[open] > summary::before {
.search-results .result-name, .search-results div.desc, .search-results .result-description {
width: 100%;
}
/* Display second row of staggered layouts */
.search-results div.desc, .search-results .result-description, item-right {
padding-left: 2em;
}