feat:copy_button

This commit is contained in:
dichgrem
2026-01-17 12:25:50 +08:00
parent 07d1060183
commit aea50b44ca
5 changed files with 72 additions and 0 deletions

32
sass/copy.scss Normal file
View File

@@ -0,0 +1,32 @@
.copy-button {
position: absolute;
top: 8px;
right: 8px;
padding: 4px 10px;
font-size: 0.8rem;
font-family: DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
background: var(--accent);
color: var(--background);
border: none;
border-radius: 3px;
cursor: pointer;
opacity: 0;
transition: opacity 0.2s ease;
z-index: 1;
&:hover {
opacity: 1;
}
&.copied {
background: #4caf50;
}
}
pre:hover .copy-button {
opacity: 0.8;
}
pre:hover .copy-button:hover {
opacity: 1;
}