16
16
--src-sidebar-width : 300px ;
17
17
--desktop-sidebar-z-index : 100 ;
18
18
--sidebar-elems-left-padding : 24px ;
19
+ /* clipboard <https://github.com/rust-lang/crates.io/commits/main/public/assets/copy.svg> */
20
+ --clipboard-image : url ('data:image/svg+xml,<svg width="19" height="18" viewBox="0 0 24 25" \
21
+ xmlns= "http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
22
+ <path d= "M18 20h2v3c0 1-1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 \
23
+ 0110 0 a3.323 3.323 0 013.333 3.333 h5C19.245 3.333 20 4.09 20 5 v8.333h-2V9H2v14h16v-3zM3 \
24
+ 7 h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0 -1.75 -.755 -1.75 -1.666 C11.75 2.755 10.957 2 10 \
25
+ 2 s-1.75.755-1.75 1.667 c0 .911 -.793 1.666 -1.75 1.666 H4.75C3.793 5.333 3 6.09 3 7 z"/>\
26
+ <path d= "M4 19h6v2H4zM12 11H4v2h8zM4 17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z" / > \
27
+ </svg>');
28
+ --copy-path-height : 34px ;
29
+ --copy-path-width : 33px ;
30
+ /* Checkmark <https://www.svgrepo.com/svg/335033/checkmark> */
31
+ --checkmark-image : url ('data:image/svg+xml,<svg viewBox="-1 -1 23 23" \
32
+ xmlns= "http://www.w3.org/2000/svg" fill="black" height="18px">\
33
+ <g> <path d= "M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414" > </path>\
34
+ </ g></svg>');
35
+ --button-left-margin : 4px ;
36
+ --button-border-radius : 2px ;
19
37
}
20
38
21
39
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -723,6 +741,11 @@ ul.block, .block li {
723
741
position : relative;
724
742
margin-bottom : 10px ;
725
743
}
744
+
745
+ .rustdoc .example-wrap > pre {
746
+ border-radius : 6px ;
747
+ }
748
+
726
749
/* For the last child of a div, the margin will be taken care of
727
750
by the margin-top of the next item. */
728
751
.rustdoc .example-wrap : last-child {
@@ -1427,25 +1450,55 @@ documentation. */
1427
1450
top : 20px ;
1428
1451
}
1429
1452
1430
- a .test-arrow {
1453
+ . example-wrap > a .test-arrow , . example-wrap . button-holder {
1431
1454
visibility : hidden;
1432
1455
position : absolute;
1433
- padding : 5px 10px 5px 10px ;
1434
- border-radius : 5px ;
1435
- font-size : 1.375rem ;
1436
- top : 5px ;
1437
- right : 5px ;
1456
+ top : 4px ;
1457
+ right : 4px ;
1438
1458
z-index : 1 ;
1459
+ }
1460
+ a .test-arrow {
1461
+ padding : 5px 7px ;
1462
+ border-radius : var (--button-border-radius );
1463
+ font-size : 1rem ;
1439
1464
color : var (--test-arrow-color );
1440
1465
background-color : var (--test-arrow-background-color );
1441
1466
}
1442
1467
a .test-arrow : hover {
1443
1468
color : var (--test-arrow-hover-color );
1444
1469
background-color : var (--test-arrow-hover-background-color );
1445
1470
}
1446
- .example-wrap : hover .test-arrow {
1471
+ .example-wrap .button-holder {
1472
+ display : flex;
1473
+ }
1474
+ .example-wrap : hover > .test-arrow {
1475
+ padding : 2px 7px ;
1476
+ }
1477
+ .example-wrap : hover > .test-arrow , .example-wrap : hover > .button-holder {
1447
1478
visibility : visible;
1448
1479
}
1480
+ .example-wrap .button-holder .copy-button {
1481
+ color : var (--copy-path-button-color );
1482
+ background : var (--main-background-color );
1483
+ height : var (--copy-path-height );
1484
+ width : var (--copy-path-width );
1485
+ margin-left : var (--button-left-margin );
1486
+ padding : 2px 0 0 4px ;
1487
+ border : 0 ;
1488
+ cursor : pointer;
1489
+ border-radius : var (--button-border-radius );
1490
+ }
1491
+ .example-wrap .button-holder .copy-button ::before {
1492
+ filter : var (--copy-path-img-filter );
1493
+ content : var (--clipboard-image );
1494
+ }
1495
+ .example-wrap .button-holder .copy-button : hover ::before {
1496
+ filter : var (--copy-path-img-hover-filter );
1497
+ }
1498
+ .example-wrap .button-holder .copy-button .clicked ::before {
1499
+ content : var (--checkmark-image );
1500
+ padding-right : 5px ;
1501
+ }
1449
1502
1450
1503
.code-attribute {
1451
1504
font-weight : 300 ;
@@ -1610,7 +1663,7 @@ a.tooltip:hover::after {
1610
1663
}
1611
1664
1612
1665
# settings-menu , # help-button {
1613
- margin-left : 4 px ;
1666
+ margin-left : var ( --button-left-margin ) ;
1614
1667
display : flex;
1615
1668
}
1616
1669
# sidebar-button {
@@ -1641,7 +1694,7 @@ a.tooltip:hover::after {
1641
1694
justify-content : center;
1642
1695
background-color : var (--button-background-color );
1643
1696
border : 1px solid var (--border-color );
1644
- border-radius : 2 px ;
1697
+ border-radius : var ( --button-border-radius ) ;
1645
1698
color : var (--settings-button-color );
1646
1699
/* Rare exception to specifying font sizes in rem. Since this is acting
1647
1700
as an icon, it's okay to specify their sizes in pixels. */
@@ -1693,8 +1746,8 @@ a.tooltip:hover::after {
1693
1746
# copy-path {
1694
1747
color : var (--copy-path-button-color );
1695
1748
background : var (--main-background-color );
1696
- height : 34 px ;
1697
- width : 33 px ;
1749
+ height : var ( --copy-path-height ) ;
1750
+ width : var ( --copy-path-width ) ;
1698
1751
margin-left : 10px ;
1699
1752
padding : 0 ;
1700
1753
padding-left : 2px ;
@@ -1703,27 +1756,13 @@ a.tooltip:hover::after {
1703
1756
}
1704
1757
# copy-path ::before {
1705
1758
filter : var (--copy-path-img-filter );
1706
- /* clipboard <https://github.com/rust-lang/crates.io/commits/main/public/assets/copy.svg> */
1707
- content : url ('data:image/svg+xml,<svg width="19" height="18" viewBox="0 0 24 25" \
1708
- xmlns= "http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
1709
- <path d= "M18 20h2v3c0 1-1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 \
1710
- 0110 0 a3.323 3.323 0 013.333 3.333 h5C19.245 3.333 20 4.09 20 5 v8.333h-2V9H2v14h16v-3zM3 \
1711
- 7 h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0 -1.75 -.755 -1.75 -1.666 C11.75 2.755 10.957 2 10 \
1712
- 2 s-1.75.755-1.75 1.667 c0 .911 -.793 1.666 -1.75 1.666 H4.75C3.793 5.333 3 6.09 3 7 z"/>\
1713
- <path d= "M4 19h6v2H4zM12 11H4v2h8zM4 17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z" / > \
1714
- </svg>');
1715
- width : 19px ;
1716
- height : 18px ;
1759
+ content : var (--clipboard-image );
1717
1760
}
1718
1761
# copy-path : hover ::before {
1719
1762
filter : var (--copy-path-img-hover-filter );
1720
1763
}
1721
1764
# copy-path .clicked ::before {
1722
- /* Checkmark <https://www.svgrepo.com/svg/335033/checkmark> */
1723
- content : url ('data:image/svg+xml,<svg viewBox="-1 -1 23 23" xmlns="http://www.w3.org/2000/svg" \
1724
- fill= "black" height="18px">\
1725
- <g> <path d= "M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414" > </path>\
1726
- </ g></svg>');
1765
+ content : var (--checkmark-image );
1727
1766
}
1728
1767
1729
1768
@keyframes rotating {
0 commit comments