mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 23:59:08 +03:00
* lw11 ga ticketing * add @types/animejs * build new game word * og ticket layout * ticket og layout * lw11 ticketing flow * remove unused assets * clean up old LW code * smol cleanup * update lw11 og function * update lw11 og function * prepare * main layout * layout * update naming * fix lw11 canvas resize * lw announcement countdown banner * hp badge * update lw page * cleanup * update banners * update ticket shape * update share string * update launch time * avatar in ticket * update lw11-og handler * mask ticket glow * update game with input-otp * clean up game * update ticketing page title * update * update awards * special event * update constants * fix mobile inputs bug * update announcements * dots grid * remove 2024 * gst * fix ticket user page * less stacked layout * lw * update secret ticket * update sharing layout * max width to ticket container * update tweet text * clean up merge * npm i * update hero announcement * update footer * update types * fix types * Update apps/www/lib/constants.ts * Update apps/www/lib/constants.ts * Update apps/www/lib/constants.ts * Apply suggestions from code review * update og * og * special announcement * special announcement * fix favicon * url timestamp for cache * cache * favicon * remove file * fix title * game only when signed in * user ticket nme * day * switch to /special-announcent * update /special-announcement * update /special-announcement * skip build * redirect * fix theme in /special-announcement * fix mobile ticket form * image not draggable * cleanup * restore latest manifest * update secret ticket tweet * secret share * update text * fix secret share * typo * remove comment * update deprecated icon * restore input.stories --------- Co-authored-by: Ant Wilson <awalias@users.noreply.github.com>
107 lines
3.5 KiB
TypeScript
107 lines
3.5 KiB
TypeScript
import React, { FC, useEffect, useRef } from 'react'
|
|
import Image from 'next/image'
|
|
import Link from 'next/link'
|
|
import { WeekDayProps, mainDays as days } from './data'
|
|
import { cn } from 'ui'
|
|
import { isBrowser } from 'common'
|
|
|
|
import SectionContainer from '~/components/Layouts/SectionContainer'
|
|
import Player from '../Album/Player'
|
|
|
|
const LWXStickyNav: FC = () => {
|
|
const OFFSET = 66
|
|
const anchors = useRef<NodeListOf<HTMLHeadingElement> | null>(null)
|
|
const links = useRef<NodeListOf<HTMLHeadingElement> | null>(null)
|
|
|
|
const handleScroll = () => {
|
|
let newActiveAnchor: string = ''
|
|
|
|
anchors.current?.forEach((anchor) => {
|
|
const { y: offsetFromTop } = anchor.getBoundingClientRect()
|
|
|
|
if (offsetFromTop - OFFSET < 0) {
|
|
newActiveAnchor = anchor.id
|
|
}
|
|
})
|
|
|
|
links.current?.forEach((link) => {
|
|
link.classList.remove('!text-foreground')
|
|
|
|
const sanitizedHref = decodeURI(link.getAttribute('href') ?? '')
|
|
.split('#')
|
|
.splice(-1)
|
|
.join('')
|
|
const isMatch = sanitizedHref === newActiveAnchor
|
|
|
|
if (isMatch) {
|
|
link.classList.add('!text-foreground')
|
|
}
|
|
})
|
|
}
|
|
|
|
useEffect(() => {
|
|
if (!isBrowser) return
|
|
anchors.current = document.querySelectorAll('.lwx-nav-anchor')
|
|
links.current = document.querySelectorAll('.lwx-sticky-nav li a')
|
|
|
|
window.addEventListener('scroll', handleScroll)
|
|
return () => {
|
|
window.removeEventListener('scroll', handleScroll)
|
|
}
|
|
}, [])
|
|
|
|
return (
|
|
<div className="absolute inset-0 pointer-events-none w-full h-full">
|
|
<nav className="sticky z-30 top-0 bg-[#06080999] backdrop-blur-sm pointer-events-auto w-full border-t border-b border-[#111718] h-[60px] flex items-center">
|
|
<SectionContainer className="!max-w-none !py-0 lg:!container flex items-center justify-between font-mono gap-4 md:gap-8 text-sm">
|
|
<div className="flex items-center gap-4 md:gap-8">
|
|
<div className="flex items-center gap-3 leading-none uppercase">
|
|
<Link href="/launch-week" className="text-foreground tracking-[1px]">
|
|
Launch Week
|
|
</Link>{' '}
|
|
<Link href="/launch-week/x">
|
|
<Image
|
|
src="/images/launchweek/lwx/logos/lwx_logo.svg"
|
|
alt="Supabase Launch Week X icon"
|
|
width={16}
|
|
height={16}
|
|
/>
|
|
</Link>
|
|
</div>
|
|
|
|
{/* Nav items */}
|
|
<ul className="lwx-sticky-nav hidden md:flex items-center gap-2 md:gap-4 text-foreground-muted">
|
|
{days.map((day: WeekDayProps) => (
|
|
<li key={day.id}>
|
|
<Link
|
|
href={`#${day.id}`}
|
|
className={cn('p-1 transition-colors hover:text-foreground flex items-center')}
|
|
>
|
|
{day.dd}{' '}
|
|
{day.isToday && (
|
|
<span
|
|
title="Live"
|
|
className="w-1 h-1 ml-1 animate-pulse rounded-full bg-brand mb-2 block"
|
|
/>
|
|
)}
|
|
</Link>
|
|
</li>
|
|
))}
|
|
<li>
|
|
<Link href="#build-stage" className="p-1 transition-colors hover:text-foreground">
|
|
Build Stage
|
|
</Link>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div>
|
|
<Player />
|
|
</div>
|
|
</SectionContainer>
|
|
</nav>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default LWXStickyNav
|