Skip to content

Commit

Permalink
Add arrow to the crate select box
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 29, 2018
1 parent 8062c7a commit afe4107
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/librustdoc/html/layout.rs
Expand Up @@ -57,6 +57,9 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
{css_extension}\
{favicon}\
{in_header}\
<style type=\"text/css\">\
#crate-search{{background-image:url(\"{root_path}down-arrow{suffix}.svg\");}}\
</style>\
</head>\
<body class=\"rustdoc {css_class}\">\
<!--[if lte IE 8]>\
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/html/render.rs
Expand Up @@ -793,6 +793,8 @@ fn write_shared(
static_files::BRUSH_SVG)?;
write(cx.dst.join(&format!("wheel{}.svg", cx.shared.resource_suffix)),
static_files::WHEEL_SVG)?;
write(cx.dst.join(&format!("down-arrow{}.svg", cx.shared.resource_suffix)),
static_files::DOWN_ARROW_SVG)?;
write_minify(cx.dst.join(&format!("light{}.css", cx.shared.resource_suffix)),
static_files::themes::LIGHT,
options.enable_minification)?;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/static/down-arrow.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/librustdoc/html/static/rustdoc.css
Expand Up @@ -621,7 +621,7 @@ a {
#crate-search {
margin-top: 5px;
padding: 6px;
padding-right: 12px;
padding-right: 19px;
border: 0;
border-right: 0;
border-radius: 4px 0 0 4px;
Expand All @@ -633,6 +633,10 @@ a {
/* Removes default arrow from firefox */
text-indent: 0.01px;
text-overflow: "";
background-repeat: no-repeat;
background-color: transparent;
background-size: 16%;
background-position: calc(100% - 1px) 56%;
}
.search-container > .top-button {
position: absolute;
Expand Down
3 changes: 3 additions & 0 deletions src/librustdoc/html/static_files.rs
Expand Up @@ -45,6 +45,9 @@ pub static BRUSH_SVG: &'static [u8] = include_bytes!("static/brush.svg");
/// The file contents of `wheel.svg`, the icon used for the settings button.
pub static WHEEL_SVG: &'static [u8] = include_bytes!("static/wheel.svg");

/// The file contents of `down-arrow.svg`, the icon used for the crate choice combobox.
pub static DOWN_ARROW_SVG: &'static [u8] = include_bytes!("static/down-arrow.svg");

/// The contents of `COPYRIGHT.txt`, the license listing for files distributed with documentation
/// output.
pub static COPYRIGHT: &'static [u8] = include_bytes!("static/COPYRIGHT.txt");
Expand Down

0 comments on commit afe4107

Please sign in to comment.