mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
Add a dismissible bar above the www nav that promotes Launch Week 16 (December 7-11) and links to /launch-week. Hide the bar on /launch-week pages. Hide it on /state-of-startups too because the fixed nav on that page would cover it. ## Banner polish Adds shared animated dot artwork, a link CTA, and responsive spacing and alignment. Reduced-motion preferences keep the dots static. Studio uses this artwork in the dependent #54512. | After | | --- | | <img width="500" height="584" alt="31035" src="https://github.com/user-attachments/assets/7ebad641-158e-47ea-a8be-3097ecc5c0ae" /> | | <img width="500" height="584" alt="18287" src="https://github.com/user-attachments/assets/02c87481-1dbe-4576-afc0-bdc9f22fc893" /> | | <img width="995" height="584" alt="89244" src="https://github.com/user-attachments/assets/aad4b608-71f1-484f-bbf4-54c725800f52" /> | | <img width="995" height="584" alt="99848" src="https://github.com/user-attachments/assets/a8b50942-1ecd-4c63-91b3-a6b4847d8830" /> | ## Review instructions 1. Open the www homepage on the preview in light and dark mode. Check the centred desktop message, link hover, and close button. 2. At a phone width, check the left-aligned copy and artwork on the right. Open the mobile menu and close it; the banner should return. 3. Dismiss the banner and reload. It should stay dismissed. Validation: scoped ESLint, formatting, and ui-patterns typecheck pass. --------- Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
63 lines
2.8 KiB
TypeScript
63 lines
2.8 KiB
TypeScript
'use client'
|
||
|
||
import { safeLocalStorage } from 'common'
|
||
import { ArrowUpRight, X } from 'lucide-react'
|
||
import { useEffect, useState } from 'react'
|
||
import { Button } from 'ui'
|
||
|
||
import { LaunchWeek16DotField } from 'ui-patterns/Banners/LaunchWeek16DotField'
|
||
|
||
const DISMISSAL_KEY = 'announcement_lw16'
|
||
|
||
export const LaunchWeek16Banner = () => {
|
||
const [hidden, setHidden] = useState(true)
|
||
|
||
useEffect(() => {
|
||
setHidden(safeLocalStorage.getItem(DISMISSAL_KEY) === 'hidden')
|
||
}, [])
|
||
|
||
const handleClose = () => {
|
||
safeLocalStorage.setItem(DISMISSAL_KEY, 'hidden')
|
||
setHidden(true)
|
||
}
|
||
|
||
if (hidden) return null
|
||
|
||
return (
|
||
<div className="relative isolate grid min-h-14 grid-cols-[minmax(0,1fr)_2rem] items-center gap-x-2 overflow-hidden border-b border-muted bg-alternative px-4 py-3 text-sm text-foreground sm:grid-cols-[2rem_minmax(0,1fr)_2rem]">
|
||
<LaunchWeek16DotField className="-z-10 [mask-image:linear-gradient(to_right,transparent_40%,black)] sm:[mask-image:linear-gradient(to_right,black,transparent_30%,transparent_70%,black)] 2xl:[mask-image:linear-gradient(to_right,black,transparent_calc(50%_-_22rem),transparent_calc(50%_+_22rem),black)]" />
|
||
<div className="col-start-1 row-start-1 flex flex-col items-start justify-center gap-1.5 text-left sm:col-start-2 sm:flex-row sm:items-center sm:gap-3 sm:text-center">
|
||
<p className="flex flex-wrap justify-start gap-x-1.5 leading-5 sm:justify-center">
|
||
<span className="font-medium">Launch Week 16</span>
|
||
<span className="text-foreground-light">/ December 7–11</span>
|
||
</p>
|
||
<span
|
||
aria-hidden="true"
|
||
className="hidden size-1 rounded-full bg-foreground-lighter sm:block"
|
||
/>
|
||
<a
|
||
href="/launch-week"
|
||
className="group inline-flex shrink-0 items-center gap-1 underline decoration-foreground/20 underline-offset-4 hover:decoration-foreground/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-brand"
|
||
>
|
||
Claim your ticket
|
||
<ArrowUpRight
|
||
aria-hidden="true"
|
||
size={16}
|
||
strokeWidth={1.5}
|
||
className="motion-safe:transition-transform motion-safe:duration-150 motion-safe:group-hover:-translate-y-px motion-safe:group-hover:translate-x-px"
|
||
/>
|
||
</a>
|
||
</div>
|
||
<Button
|
||
type="button"
|
||
variant="text"
|
||
size="tiny"
|
||
icon={<X size={16} strokeWidth={1.5} />}
|
||
aria-label="Dismiss announcement"
|
||
onClick={handleClose}
|
||
className="col-start-2 row-start-1 justify-self-end bg-alternative/50 px-1 text-foreground-lighter motion-safe:transition-colors motion-safe:duration-150 hover:bg-foreground/5 hover:text-foreground sm:col-start-3"
|
||
/>
|
||
</div>
|
||
)
|
||
}
|