Skip to content

Commit

Permalink
Unify UI between code block buttons and top buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 18, 2024
1 parent 578810b commit 26d7251
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 14 additions & 7 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
<g><path d="M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414"></path>\
</g></svg>');
--button-left-margin: 4px;
--button-border-radius: 2px;
}

/* See FiraSans-LICENSE.txt for the Fira Sans license. */
Expand Down Expand Up @@ -740,6 +742,11 @@ ul.block, .block li {
position: relative;
margin-bottom: 10px;
}

.rustdoc .example-wrap > pre {
border-radius: 6px;
}

/* For the last child of a div, the margin will be taken care of
by the margin-top of the next item. */
.rustdoc .example-wrap:last-child {
Expand Down Expand Up @@ -1442,13 +1449,13 @@ documentation. */
.example-wrap > a.test-arrow, .example-wrap .button-holder {
visibility: hidden;
position: absolute;
top: 5px;
right: 5px;
top: 4px;
right: 4px;
z-index: 1;
}
a.test-arrow {
padding: 5px 7px;
border-radius: 5px;
border-radius: var(--button-border-radius);
font-size: 1rem;
color: var(--test-arrow-color);
background-color: var(--test-arrow-background-color);
Expand All @@ -1471,11 +1478,11 @@ a.test-arrow:hover {
background: var(--main-background-color);
height: var(--copy-path-height);
width: var(--copy-path-width);
margin-left: 5px;
margin-left: var(--button-left-margin);
padding: 2px 0 0 4px;
border: 0;
cursor: pointer;
border-radius: 5px;
border-radius: var(--button-border-radius);
}
.example-wrap .button-holder .copy-button::before {
filter: var(--copy-path-img-filter);
Expand Down Expand Up @@ -1652,7 +1659,7 @@ a.tooltip:hover::after {
}

#settings-menu, #help-button {
margin-left: 4px;
margin-left: var(--button-left-margin);
display: flex;
}
#sidebar-button {
Expand Down Expand Up @@ -1683,7 +1690,7 @@ a.tooltip:hover::after {
justify-content: center;
background-color: var(--button-background-color);
border: 1px solid var(--border-color);
border-radius: 2px;
border-radius: var(--button-border-radius);
color: var(--settings-button-color);
/* Rare exception to specifying font sizes in rem. Since this is acting
as an icon, it's okay to specify their sizes in pixels. */
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-gui/run-on-hover.goml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ define-function: (
"color": |color|,
"background-color": |background|,
"font-size": "16px",
"border-radius": "5px",
"border-radius": "2px",
})
move-cursor-to: ".test-arrow"
assert-css: (".test-arrow:hover", {
"visibility": "visible",
"color": |hover_color|,
"background-color": |hover_background|,
"font-size": "16px",
"border-radius": "5px",
"border-radius": "2px",
})
},
)
Expand Down

0 comments on commit 26d7251

Please sign in to comment.