Skip to content

Commit 26d7251

Browse files
Unify UI between code block buttons and top buttons
1 parent 578810b commit 26d7251

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/librustdoc/html/static/css/rustdoc.css

+14-7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
3232
xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
3333
<g><path d="M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414"></path>\
3434
</g></svg>');
35+
--button-left-margin: 4px;
36+
--button-border-radius: 2px;
3537
}
3638

3739
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -740,6 +742,11 @@ ul.block, .block li {
740742
position: relative;
741743
margin-bottom: 10px;
742744
}
745+
746+
.rustdoc .example-wrap > pre {
747+
border-radius: 6px;
748+
}
749+
743750
/* For the last child of a div, the margin will be taken care of
744751
by the margin-top of the next item. */
745752
.rustdoc .example-wrap:last-child {
@@ -1442,13 +1449,13 @@ documentation. */
14421449
.example-wrap > a.test-arrow, .example-wrap .button-holder {
14431450
visibility: hidden;
14441451
position: absolute;
1445-
top: 5px;
1446-
right: 5px;
1452+
top: 4px;
1453+
right: 4px;
14471454
z-index: 1;
14481455
}
14491456
a.test-arrow {
14501457
padding: 5px 7px;
1451-
border-radius: 5px;
1458+
border-radius: var(--button-border-radius);
14521459
font-size: 1rem;
14531460
color: var(--test-arrow-color);
14541461
background-color: var(--test-arrow-background-color);
@@ -1471,11 +1478,11 @@ a.test-arrow:hover {
14711478
background: var(--main-background-color);
14721479
height: var(--copy-path-height);
14731480
width: var(--copy-path-width);
1474-
margin-left: 5px;
1481+
margin-left: var(--button-left-margin);
14751482
padding: 2px 0 0 4px;
14761483
border: 0;
14771484
cursor: pointer;
1478-
border-radius: 5px;
1485+
border-radius: var(--button-border-radius);
14791486
}
14801487
.example-wrap .button-holder .copy-button::before {
14811488
filter: var(--copy-path-img-filter);
@@ -1652,7 +1659,7 @@ a.tooltip:hover::after {
16521659
}
16531660

16541661
#settings-menu, #help-button {
1655-
margin-left: 4px;
1662+
margin-left: var(--button-left-margin);
16561663
display: flex;
16571664
}
16581665
#sidebar-button {
@@ -1683,7 +1690,7 @@ a.tooltip:hover::after {
16831690
justify-content: center;
16841691
background-color: var(--button-background-color);
16851692
border: 1px solid var(--border-color);
1686-
border-radius: 2px;
1693+
border-radius: var(--button-border-radius);
16871694
color: var(--settings-button-color);
16881695
/* Rare exception to specifying font sizes in rem. Since this is acting
16891696
as an icon, it's okay to specify their sizes in pixels. */

tests/rustdoc-gui/run-on-hover.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ define-function: (
1818
"color": |color|,
1919
"background-color": |background|,
2020
"font-size": "16px",
21-
"border-radius": "5px",
21+
"border-radius": "2px",
2222
})
2323
move-cursor-to: ".test-arrow"
2424
assert-css: (".test-arrow:hover", {
2525
"visibility": "visible",
2626
"color": |hover_color|,
2727
"background-color": |hover_background|,
2828
"font-size": "16px",
29-
"border-radius": "5px",
29+
"border-radius": "2px",
3030
})
3131
},
3232
)

0 commit comments

Comments
 (0)