Skip to content

Commit c5469ab

Browse files
Unify UI between code block buttons and top buttons
1 parent ed8e8c9 commit c5469ab

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
@@ -31,6 +31,8 @@ xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
3131
xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
3232
<g><path d="M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414"></path>\
3333
</g></svg>');
34+
--button-left-margin: 4px;
35+
--button-border-radius: 2px;
3436
}
3537

3638
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -693,6 +695,11 @@ ul.block, .block li {
693695
position: relative;
694696
margin-bottom: 10px;
695697
}
698+
699+
.rustdoc .example-wrap > pre {
700+
border-radius: 6px;
701+
}
702+
696703
/* For the last child of a div, the margin will be taken care of
697704
by the margin-top of the next item. */
698705
.rustdoc .example-wrap:last-child {
@@ -1395,13 +1402,13 @@ documentation. */
13951402
.example-wrap > a.test-arrow, .example-wrap .button-holder {
13961403
visibility: hidden;
13971404
position: absolute;
1398-
top: 5px;
1399-
right: 5px;
1405+
top: 4px;
1406+
right: 4px;
14001407
z-index: 1;
14011408
}
14021409
a.test-arrow {
14031410
padding: 5px 7px;
1404-
border-radius: 5px;
1411+
border-radius: var(--button-border-radius);
14051412
font-size: 1rem;
14061413
color: var(--test-arrow-color);
14071414
background-color: var(--test-arrow-background-color);
@@ -1424,11 +1431,11 @@ a.test-arrow:hover {
14241431
background: var(--main-background-color);
14251432
height: var(--copy-path-height);
14261433
width: var(--copy-path-width);
1427-
margin-left: 5px;
1434+
margin-left: var(--button-left-margin);
14281435
padding: 2px 0 0 4px;
14291436
border: 0;
14301437
cursor: pointer;
1431-
border-radius: 5px;
1438+
border-radius: var(--button-border-radius);
14321439
}
14331440
.example-wrap .button-holder .copy-button::before {
14341441
filter: var(--copy-path-img-filter);
@@ -1605,7 +1612,7 @@ a.tooltip:hover::after {
16051612
}
16061613

16071614
#settings-menu, #help-button {
1608-
margin-left: 4px;
1615+
margin-left: var(--button-left-margin);
16091616
display: flex;
16101617
}
16111618
#sidebar-button {
@@ -1636,7 +1643,7 @@ a.tooltip:hover::after {
16361643
justify-content: center;
16371644
background-color: var(--button-background-color);
16381645
border: 1px solid var(--border-color);
1639-
border-radius: 2px;
1646+
border-radius: var(--button-border-radius);
16401647
color: var(--settings-button-color);
16411648
/* Rare exception to specifying font sizes in rem. Since this is acting
16421649
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)