mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
feat(www): add Launch Week 16 banner (#54511)
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>
This commit is contained in:
1 parent
cf63aa5459
commit
28c2c2dd53
5 files changed
+155
No files matched your search
@@ -0,0 +1,62 @@
|
||||
'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>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { LaunchWeek16Banner } from 'components/Announcement/LaunchWeek16Banner'
|
||||
import ScrollProgress from 'components/ScrollProgress'
|
||||
import { getMenu } from 'data/nav'
|
||||
import { DevToolbarTrigger } from 'dev-tools'
|
||||
@@ -62,6 +63,7 @@ const Nav = ({ hideNavbar, stickyNavbar = true }: Props) => {
|
||||
|
||||
const isGAWeekSection = pathname?.startsWith('/ga-week')
|
||||
const isStateOfStartupsPage = pathname?.startsWith('/state-of-startups')
|
||||
const hideLaunchWeekBanner = isStateOfStartupsPage || pathname?.startsWith('/launch-week')
|
||||
const disableStickyNav = isGAWeekSection || !stickyNavbar
|
||||
const showLaunchWeekNavMode = isGAWeekSection && !open
|
||||
|
||||
@@ -84,6 +86,11 @@ const Nav = ({ hideNavbar, stickyNavbar = true }: Props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{!hideLaunchWeekBanner && (
|
||||
<div className={cn(open && 'hidden')}>
|
||||
<LaunchWeek16Banner />
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className={cn(
|
||||
'sticky top-0 z-40 transform',
|
||||
|
||||
@@ -58,6 +58,15 @@
|
||||
"import": "./src/Banners/Countdown.tsx",
|
||||
"types": "./src/Banners/Countdown.tsx"
|
||||
},
|
||||
"./Banners/LaunchWeek16DotField.module.css": {
|
||||
"style": "./src/Banners/LaunchWeek16DotField.module.css",
|
||||
"import": "./src/Banners/LaunchWeek16DotField.module.css",
|
||||
"types": "./src/Banners/LaunchWeek16DotField.module.css"
|
||||
},
|
||||
"./Banners/LaunchWeek16DotField": {
|
||||
"import": "./src/Banners/LaunchWeek16DotField.tsx",
|
||||
"types": "./src/Banners/LaunchWeek16DotField.tsx"
|
||||
},
|
||||
"./Chart/charts/chart-bar": {
|
||||
"import": "./src/Chart/charts/chart-bar.tsx",
|
||||
"types": "./src/Chart/charts/chart-bar.tsx"
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
.dot {
|
||||
transform-box: fill-box;
|
||||
transform-origin: center;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.dot {
|
||||
animation: dot-drift 4s ease-in-out infinite alternate;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes dot-drift {
|
||||
from {
|
||||
transform: scale(0.6);
|
||||
}
|
||||
to {
|
||||
transform: scale(1.3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
'use client'
|
||||
|
||||
import { useId } from 'react'
|
||||
import { cn } from 'ui'
|
||||
|
||||
import styles from './LaunchWeek16DotField.module.css'
|
||||
|
||||
const WAVE_DOTS = Array.from({ length: 96 * 12 }, (_, index) => {
|
||||
const column = index % 96
|
||||
const row = Math.floor(index / 96)
|
||||
const seed = Math.sin(column * 127.1 + row * 311.7) * 43758.5453
|
||||
const variation = seed - Math.floor(seed)
|
||||
const phaseSeed = Math.sin(column * 269.5 + row * 183.3) * 43758.5453
|
||||
const phase = phaseSeed - Math.floor(phaseSeed)
|
||||
const field =
|
||||
(Math.sin(column * 0.18 + Math.sin(row * 0.22) * 0.8) +
|
||||
Math.cos(column * 0.39 - row * 0.12) * 0.45 +
|
||||
1.45) /
|
||||
2.9
|
||||
|
||||
return {
|
||||
cx: column * 9 + 4.5,
|
||||
cy: row * 9 + 4.5,
|
||||
r: 0.35 + field ** 1.5 * 2,
|
||||
opacity: variation < field * 0.85 + 0.15 ? 0.45 + field * 0.55 : 0,
|
||||
duration: 1 + phase,
|
||||
delay: -variation * 2,
|
||||
}
|
||||
})
|
||||
|
||||
export const LaunchWeek16DotField = ({ className }: { className?: string }) => {
|
||||
const patternId = useId()
|
||||
|
||||
return (
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
'pointer-events-none absolute inset-0 h-full w-full text-brand opacity-40',
|
||||
className
|
||||
)}
|
||||
>
|
||||
<defs>
|
||||
<pattern id={patternId} width="864" height="108" patternUnits="userSpaceOnUse">
|
||||
{WAVE_DOTS.map(({ duration, delay, ...dot }, index) => (
|
||||
<circle
|
||||
key={index}
|
||||
{...dot}
|
||||
fill="currentColor"
|
||||
className={styles.dot}
|
||||
style={{ animationDuration: `${duration}s`, animationDelay: `${delay}s` }}
|
||||
/>
|
||||
))}
|
||||
</pattern>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill={`url(#${patternId})`} />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user