start work on client side explorer

This commit is contained in:
Jacky Zhao
2025-03-06 22:35:24 -08:00
parent a201105442
commit 08717394ff
20 changed files with 681 additions and 593 deletions

View File

@@ -0,0 +1,40 @@
import { JSX } from "preact"
const OverflowList = ({
children,
...props
}: JSX.HTMLAttributes<HTMLUListElement> & { id: string }) => {
return (
<ul class="overflow" {...props}>
{children}
<li class="overflow-end" />
</ul>
)
}
OverflowList.afterDOMLoaded = (id: string) => `
document.addEventListener("nav", (e) => {
const observer = new IntersectionObserver((entries) => {
for (const entry of entries) {
const parentUl = entry.target.parentElement
console.log(parentUl)
if (entry.isIntersecting) {
parentUl.classList.remove("gradient-active")
} else {
parentUl.classList.add("gradient-active")
}
}
})
const ul = document.getElementById("${id}")
if (!ul) return
const end = ul.querySelector(".overflow-end")
if (!end) return
observer.observe(end)
window.addCleanup(() => observer.disconnect())
})
`
export default OverflowList