Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Site: the Download button in the nav rounds into a pill as the nav starts to float

Eric Brownrout44c2c17fb023
diff --git a/site/public/marketing/navigation.mjs b/site/public/marketing/navigation.mjs
index f79d787a..6ce0be9a 100644
--- a/site/public/marketing/navigation.mjs
+++ b/site/public/marketing/navigation.mjs
@@ -19,6 +19,7 @@ function paint() {
left.style.transform = `translate(${endX}px, ${top}px) scale(${scale})`
middle.style.transform = `translate(${seam - 2}px, ${top}px) scale(${width - 2 * seam + 4}, ${scale})`
right.style.transform = `translate(${width - seam}px, ${top}px) scale(${scale})`
+ nav.style.setProperty('--nav-download-radius', (8 + (geometry.downloadRadius - 8) * position) + 'px')
const dy = (pillTop + (pillHeight - height) / 2) * position
wordmark.style.transform = `translate(${logoShift * position}px, ${dy}px)`
nav.style.transform = `translate(${navShift * position}px, ${dy}px)`
@@ -64,14 +65,17 @@ function measure() {
const { left, right, height } = header.getBoundingClientRect()
const width = shell.clientWidth
const phone = matchMedia('(max-width: 760px)').matches
- const pad = phone ? 10 : 14
// The theme toggle is absolutely positioned just before the links.
const controlsWidth = nav.offsetWidth - Math.min(0, toggle.offsetLeft)
- const pillWidth = Math.min(width - 8, 2 * pad + wordmark.offsetWidth + (phone ? 12 : 26) + controlsWidth)
+ const pillHeight = phone ? 48 : 52
+ const downloadHeight = nav.querySelector('.nav-download').offsetHeight
+ const rightPad = (pillHeight - downloadHeight) / 2
+ const leftPad = phone ? 12 : 16
+ const pillWidth = Math.min(width - 8, leftPad + wordmark.offsetWidth + (phone ? 12 : 26) + controlsWidth + rightPad)
const inset = (width - pillWidth) / 2
geometry = {
- width, height, inset, pillTop: phone ? 8 : 10, pillHeight: phone ? 48 : 52,
- logoShift: inset + pad - left, navShift: width - inset - pad - right,
+ width, height, inset, pillTop: phone ? 8 : 10, pillHeight, downloadRadius: downloadHeight / 2,
+ logoShift: inset + leftPad - left, navShift: width - inset - rightPad - right,
threshold: hero.getBoundingClientRect().bottom + scrollY - height,
}
update(true)
diff --git a/site/public/marketing/site.css b/site/public/marketing/site.css
index d5907f5c..ff6f8871 100644
--- a/site/public/marketing/site.css
+++ b/site/public/marketing/site.css
@@ -1403,6 +1403,7 @@ body[data-background=ribbon] .hero-copy{padding-bottom:70px}
}
.site-header nav .nav-download {
display: inline-flex;
+ border-radius: var(--nav-download-radius, 8px);
}
.hero .hero-copy {
width: var(--content-width);
diff --git a/site/scripts/navigation.test.mjs b/site/scripts/navigation.test.mjs
index f7ca7b22..d2048a36 100644
--- a/site/scripts/navigation.test.mjs
+++ b/site/scripts/navigation.test.mjs
@@ -7,7 +7,8 @@ for (const width of [1280, 390, 320]) {
const phone = width < 761, height = phone ? 72 : 80
const wordmark = { offsetWidth: phone ? 92 : 108, style: {} }
const toggle = { offsetLeft: -44 }
- const nav = { offsetWidth: 130, style: {}, querySelector: () => toggle }
+ const download = { offsetHeight: phone ? 32 : 36 }
+ const nav = { offsetWidth: 130, style: { setProperty(k, v) { this[k] = v } }, querySelector: selector => selector === '.theme-toggle' ? toggle : download }
const header = {
getBoundingClientRect: () => ({ left: 16, right: width - 16, height }),
querySelector: selector => selector === 'nav' ? nav : wordmark,
@@ -44,12 +45,20 @@ for (const width of [1280, 390, 320]) {
reduced = true
motionChange()
const compact = wordmark.style.transform
+ const x = el => parseFloat(el.style.transform.slice('translate('.length))
+ const pillLeft = x(surface.children[0])
+ const rightPad = width - pillLeft - (width - 16 + x(nav))
+ const leftPad = 16 + x(wordmark) - pillLeft
+ assert.equal(rightPad, ((phone ? 48 : 52) - download.offsetHeight) / 2)
+ assert.equal(leftPad, phone ? 12 : 16)
+ assert.equal(nav.style['--nav-download-radius'], download.offsetHeight / 2 + 'px')
assert.notEqual(compact, original)
assert(!frame, 'enabling reduced motion finishes the current morph')
move(1000 - height - 5)
assert.equal(wordmark.style.transform, compact, 'nearby scroll jitter keeps the same state')
move(0)
assert.equal(wordmark.style.transform, original)
+ assert.equal(nav.style['--nav-download-radius'], '8px')
assert(!frame, 'reduced motion changes states immediately')
}
console.log('Sticky navigation threshold, reversal, settling and reduced motion passed at desktop and phone widths.')