auto merge of #14878 : vtsatskin/rust/rustdoc-sidebar-click-targets, r=alexcrichton

There was feedback gathered by @bjz which request for larger click targets in the rustdoc sidebar. Here's my attempt at that.

My only concern with this patch is the removal of `<br>` between sidebar links. This may break formatting for text-only viewers of this documentation. If there is a large enough demographic of people that will be affected, perhaps we can try switching the structure of each sidebar block sidebar to an `<ol>` with each item as a `<li>`. 

* Change links to display:block for click larger targets
* Remove linebreaks due to extra space
* Adjust margins so that element spacing stays the same
* Sidebar item hover background colour chosen from `<pre>` styling
This commit is contained in:
bors 2014-06-14 04:46:46 +00:00
commit 2c6caad1ba
3 changed files with 9 additions and 6 deletions

View File

@ -2001,7 +2001,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
let class = if cur.name.get_ref() == item &&
short == curty { "current" } else { "" };
try!(write!(w, "<a class='{ty} {class}' href='{href}{path}'>\
{name}</a><br/>",
{name}</a>",
ty = short,
class = class,
href = if curty == "mod" {"../"} else {""},

View File

@ -154,25 +154,29 @@ nav.sub {
.block {
padding: 0 10px;
margin-bottom: 10px;
margin-bottom: 14px;
}
.block h2 {
margin-top: 0;
margin-bottom: 8px;
text-align: center;
}
.block a {
display: inline-block;
display: block;
text-overflow: ellipsis;
overflow: hidden;
line-height: 15px;
padding-left: 5px;
padding-bottom: 6px;
padding: 7px 5px;
font-size: 14px;
font-weight: 300;
transition: border 500ms ease-out;
}
.block a:hover {
background: #F5F5F5;
}
.content {
padding: 15px 0;
}

View File

@ -647,7 +647,6 @@
}
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
'class': klass}).text(crates[i]));
div.append($('<br>'));
}
sidebar.append(div);
}