Skip to content

Commit ffb8b2a

Browse files
committed
Refine download cards and copy button placement
- Move copy icon outside code blocks (flex row layout) - Use SVG clipboard/check icons instead of text - Show repo URL in header instead of "GitHub" - Add CachyOS to Arch card, derivatives to deb/rpm cards
1 parent da9e71f commit ffb8b2a

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

index.html

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,38 @@
3838
overflow-x: auto;
3939
font-size: 0.875rem;
4040
margin-bottom: 1rem;
41-
position: relative;
4241
}
43-
pre[data-copy] { padding-right: 3.5rem; }
42+
.code-row {
43+
display: flex;
44+
align-items: stretch;
45+
gap: 0.5rem;
46+
margin-bottom: 1rem;
47+
}
48+
.code-row pre {
49+
flex: 1;
50+
min-width: 0;
51+
margin-bottom: 0;
52+
}
4453
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
4554
section { margin-bottom: 2rem; }
4655
.note { color: #8b949e; font-size: 0.8rem; margin-top: 0.25rem; }
4756

4857
/* Copy button */
4958
.copy-btn {
50-
position: absolute;
51-
top: 0.5rem;
52-
right: 0.5rem;
59+
flex-shrink: 0;
60+
align-self: stretch;
5361
background: #21262d;
5462
border: 1px solid #30363d;
5563
color: #8b949e;
56-
font-size: 0.75rem;
57-
padding: 0.2rem 0.5rem;
64+
padding: 0 0.4rem;
5865
border-radius: 4px;
5966
cursor: pointer;
60-
font-family: inherit;
67+
line-height: 0;
6168
transition: color 0.15s, border-color 0.15s;
6269
}
6370
.copy-btn:hover { color: #e6edf3; border-color: #8b949e; }
6471
.copy-btn.copied { color: #3fb950; border-color: #3fb950; }
72+
.copy-btn svg { width: 16px; height: 16px; fill: currentColor; }
6573

6674
/* Download cards */
6775
.card {
@@ -99,10 +107,11 @@
99107
font-size: 0.8rem;
100108
white-space: nowrap;
101109
}
102-
.card pre {
110+
.card .code-row {
103111
margin-top: 0.75rem;
104112
margin-bottom: 0;
105113
}
114+
.card .code-row pre { margin-bottom: 0; }
106115
.checksum-link {
107116
text-align: center;
108117
margin-top: 0.5rem;
@@ -116,7 +125,7 @@
116125
<h1>sdme</h1>
117126
<p class="tagline">Lightweight systemd containers with overlayfs</p>
118127
<div class="header-links">
119-
<a href="https://github.com/fiorix/sdme">GitHub</a>
128+
<a href="https://github.com/fiorix/sdme">github.com/fiorix/sdme</a>
120129
<span id="version-badge" class="version-badge"></span>
121130
</div>
122131

@@ -154,20 +163,29 @@ <h2>Downloads</h2>
154163
(function() {
155164
'use strict';
156165

166+
// --- SVG icons (GitHub Octicons) ---
167+
var ICON_COPY = '<svg viewBox="0 0 16 16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg>';
168+
var ICON_CHECK = '<svg viewBox="0 0 16 16"><path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.75.75 0 0 1 1.06-1.06L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg>';
169+
157170
// --- Copy-to-clipboard buttons ---
158171
function addCopyButtons() {
159172
document.querySelectorAll('pre[data-copy]').forEach(function(pre) {
160-
if (pre.querySelector('.copy-btn')) return;
173+
if (pre.parentNode.classList.contains('code-row')) return;
174+
var wrapper = document.createElement('div');
175+
wrapper.className = 'code-row';
176+
pre.parentNode.insertBefore(wrapper, pre);
177+
wrapper.appendChild(pre);
161178
var btn = document.createElement('button');
162179
btn.className = 'copy-btn';
163-
btn.textContent = 'Copy';
180+
btn.innerHTML = ICON_COPY;
181+
btn.title = 'Copy';
164182
btn.addEventListener('click', function() {
165183
var text = pre.querySelector('code')
166184
? pre.querySelector('code').textContent
167185
: pre.textContent;
168186
copyText(text.trim(), btn);
169187
});
170-
pre.appendChild(btn);
188+
wrapper.appendChild(btn);
171189
});
172190
}
173191

@@ -196,10 +214,10 @@ <h2>Downloads</h2>
196214
}
197215

198216
function showCopied(btn) {
199-
btn.textContent = 'Copied!';
217+
btn.innerHTML = ICON_CHECK;
200218
btn.classList.add('copied');
201219
setTimeout(function() {
202-
btn.textContent = 'Copy';
220+
btn.innerHTML = ICON_COPY;
203221
btn.classList.remove('copied');
204222
}, 2000);
205223
}
@@ -263,7 +281,7 @@ <h2>Downloads</h2>
263281
{
264282
type: 'deb',
265283
title: '.deb Packages',
266-
distros: 'Debian, Ubuntu',
284+
distros: 'Debian, Ubuntu, and derivatives',
267285
deps: 'Dependencies auto-resolved: <strong>systemd (&ge; 252)</strong>, <strong>systemd-container</strong>. Suggests: qemu-utils, apparmor',
268286
cmdTemplate: function(url, filename) {
269287
return 'curl -fSLO ' + url + ' && sudo apt install ./' + filename;
@@ -272,7 +290,7 @@ <h2>Downloads</h2>
272290
{
273291
type: 'rpm',
274292
title: '.rpm Packages',
275-
distros: 'Fedora, CentOS Stream, AlmaLinux, RHEL',
293+
distros: 'Fedora, CentOS Stream, AlmaLinux, RHEL, and derivatives',
276294
deps: 'Dependencies auto-resolved: <strong>systemd &ge; 252</strong>, <strong>systemd-container</strong>',
277295
cmdTemplate: function(url, filename) {
278296
return 'curl -fSLO ' + url + ' && sudo dnf install ./' + filename;
@@ -281,7 +299,7 @@ <h2>Downloads</h2>
281299
{
282300
type: 'pkg',
283301
title: '.pkg.tar.zst Packages',
284-
distros: 'Arch Linux',
302+
distros: 'Arch Linux, CachyOS, and derivatives',
285303
deps: 'Requires <strong>systemd &ge; 252</strong> (includes systemd-nspawn on Arch)',
286304
cmdTemplate: function(url, filename) {
287305
return 'curl -fSLO ' + url + ' && sudo pacman -U ' + filename;

0 commit comments

Comments
 (0)