)
}
// Places the selected-tab pill (`.install__os::before`) under the chosen tab.
// Until the first measurement the selected tab paints its own background, so
// the prerendered page and a page without scripts still show the selection.
// The pill slides only after a click (`data-animate`), so the OS picked from
// the user agent on load doesn't animate in from macOS.
function useTabIndicator(list: RefObject, selected: Os) {
useLayoutEffect(() => {
const element = list.current
if (!element) return
const place = () => {
const tab = element.querySelector('[aria-selected="true"]')
if (!tab) return
element.style.setProperty("--tab-x", `${tab.offsetLeft}px`)
element.style.setProperty("--tab-width", `${tab.offsetWidth}px`)
element.dataset.measured = ""
}
place()
// Tab widths change when Inter finishes loading or the viewport resizes.
const observer = new ResizeObserver(place)
observer.observe(element)
return () => observer.disconnect()
}, [list, selected])
}
// Every OS, architecture, and package for a visitor without scripts, because
// the tabs and the switches inside a row are buttons. It is hidden whenever
// scripts run; index.html's