Skip to content

Commit 26c44b1

Browse files
feat: revamp download section on landing page for better visibility
Replaced the "Other downloads" details element with a more accessible layout that displays all platform download links directly. Enhanced styling for the download links to improve user experience and visibility. Added functionality to prevent duplicate download options from appearing based on the selected platform. Updated CSS for improved layout and interaction.
1 parent eca3af9 commit 26c44b1

2 files changed

Lines changed: 65 additions & 39 deletions

File tree

apps/landing/index.html

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,14 @@ <h1>All of Nepal, on your menu bar.</h1>
7878
Download for macOS
7979
</a>
8080
<p class="download-note">Free and open source · macOS, Windows, Linux</p>
81-
<details class="other-platforms" id="other-platforms">
82-
<summary>Other downloads</summary>
83-
<div class="other-platforms-links">
84-
<a href="/dl/macos-arm64">macOS (Apple Silicon)</a>
85-
<a href="/dl/macos-x64">macOS (Intel)</a>
86-
<a href="/dl/windows">Windows</a>
87-
<a href="/dl/linux-deb">Linux (.deb)</a>
88-
<a href="/dl/linux-appimage">Linux (AppImage)</a>
89-
</div>
90-
</details>
81+
<div class="other-platforms" id="other-platforms">
82+
<span class="other-platforms-label">Also for</span>
83+
<a href="/dl/macos-arm64" data-platform="macos-arm64">macOS (Apple Silicon)</a>
84+
<a href="/dl/macos-x64" data-platform="macos-x64">macOS (Intel)</a>
85+
<a href="/dl/windows" data-platform="windows">Windows</a>
86+
<a href="/dl/linux-deb" data-platform="linux-deb">Linux (.deb)</a>
87+
<a href="/dl/linux-appimage" data-platform="linux-appimage">Linux (AppImage)</a>
88+
</div>
9189
</div>
9290
</div>
9391

@@ -286,9 +284,21 @@ <h3>Linux</h3>
286284
var MAC_ARM = { href: "/dl/macos-arm64", label: "Download for macOS (Apple Silicon)" };
287285
var MAC_INTEL = { href: "/dl/macos-x64", label: "Download for macOS (Intel)" };
288286

287+
// The row below the button lists every other platform. Whichever one the
288+
// button itself already offers is dropped from it, so the same download is
289+
// never presented twice.
290+
function dedupe() {
291+
var current = btn.getAttribute("href");
292+
var links = document.querySelectorAll("#other-platforms a");
293+
for (var i = 0; i < links.length; i++) {
294+
links[i].hidden = links[i].getAttribute("href") === current;
295+
}
296+
}
297+
289298
function setMac(target) {
290299
btn.href = target.href;
291300
btn.textContent = target.label;
301+
dedupe();
292302
}
293303

294304
if (isMac) {
@@ -337,12 +347,26 @@ <h3>Linux</h3>
337347
}
338348
}
339349

350+
// Scrolls the track and nothing else. `scrollIntoView` walks every
351+
// scrollable ancestor including the page, so with autoplay running it
352+
// dragged the whole document downwards every few seconds.
353+
function centreSlide(index) {
354+
var slide = slides[index];
355+
var offset = slide.offsetLeft - (track.clientWidth - slide.clientWidth) / 2;
356+
var left = Math.max(0, Math.min(offset, track.scrollWidth - track.clientWidth));
357+
if (track.scrollTo) {
358+
track.scrollTo({ left: left, behavior: reduceMotion ? "auto" : "smooth" });
359+
} else {
360+
track.scrollLeft = left;
361+
}
362+
}
363+
340364
function setActive(i, loop) {
341365
current = loop
342366
? (i + slides.length) % slides.length
343367
: Math.max(0, Math.min(slides.length - 1, i));
344368
updateChrome();
345-
slides[current].scrollIntoView({ behavior: "smooth", inline: "center", block: "nearest" });
369+
centreSlide(current);
346370
}
347371

348372
function syncCurrentFromScroll() {

apps/landing/style.css

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -326,53 +326,55 @@ img {
326326
color: var(--text-muted);
327327
}
328328

329+
/* Every platform on show, not folded away behind a disclosure. Two in five
330+
visitors are not on the Mac the big button offers, and asking them to notice
331+
a grey "Other downloads" line first is asking too much. */
329332
.other-platforms {
333+
display: flex;
334+
flex-wrap: wrap;
335+
align-items: baseline;
336+
gap: 6px 12px;
330337
font-size: 13px;
331338
color: var(--text-muted);
332339
}
333340

334-
.other-platforms summary {
335-
cursor: pointer;
336-
list-style: none;
341+
.other-platforms-label {
337342
color: var(--text-muted);
338-
border-bottom: 1px dotted var(--border);
339-
width: max-content;
340-
transition: color 0.15s var(--ease-out-quart);
341-
}
342-
343-
.other-platforms summary::-webkit-details-marker {
344-
display: none;
345-
}
346-
347-
.other-platforms summary:hover {
348-
color: var(--gold);
349-
}
350-
351-
.other-platforms-links {
352-
display: flex;
353-
gap: 6px 14px;
354-
flex-wrap: wrap;
355-
padding-top: 10px;
356343
}
357344

358345
@media (max-width: 900px) {
359-
.other-platforms summary {
360-
margin-inline: auto;
361-
}
362-
363-
.other-platforms-links {
346+
.other-platforms {
364347
justify-content: center;
365348
}
366349
}
367350

351+
/* Chips rather than a run of links: five plain anchors in a row read as one
352+
sentence, and the reader cannot see where one download ends and the next
353+
begins. */
368354
.other-platforms a {
369-
color: var(--text-muted);
355+
display: inline-flex;
356+
align-items: center;
357+
padding: 5px 11px;
358+
border-radius: 999px;
359+
border: 1px solid var(--border);
360+
background: var(--surface-raised);
361+
color: var(--text-secondary);
370362
text-decoration: none;
371-
border-bottom: 1px dotted color-mix(in srgb, var(--border) 100%, transparent);
363+
white-space: nowrap;
364+
transition: color 0.15s var(--ease-out-quart),
365+
border-color 0.15s var(--ease-out-quart),
366+
background-color 0.15s var(--ease-out-quart);
372367
}
373368

374369
.other-platforms a:hover {
375370
color: var(--gold);
371+
border-color: color-mix(in srgb, var(--gold) 45%, transparent);
372+
background: var(--surface-hover);
373+
}
374+
375+
/* The platform the big button already offers. */
376+
.other-platforms a[hidden] {
377+
display: none;
376378
}
377379

378380
.hero-shot {

0 commit comments

Comments
 (0)