Featured cards and the connect section as one ruled block; Give beside the footer logo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6fc19d7ee3
commit
5dbb203519
3 changed files with 109 additions and 93 deletions
|
|
@ -13,14 +13,20 @@
|
|||
|
||||
Re-keying the panel on the selected index is what replays the
|
||||
entrance animation for each choice.
|
||||
|
||||
Drawn like the featured cards (FeaturedCards.tsx): one continuous
|
||||
block, no gaps and no frame, a colored rule between cells. The
|
||||
paths are a strip of cells along the top, the chosen one filled
|
||||
flat in its accent; under it, the path's blurb and its actions
|
||||
are cells of the same block.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight, ArrowUpRight, BookOpen, CalendarBlank, ChatCircle, Compass, GraduationCap, HandHeart, Heart, House, MapPin, MusicNotes, Sparkle, Star, Tent, UsersThree, type Icon } from '@phosphor-icons/react'
|
||||
import { useId, useRef, useState, type KeyboardEvent } from 'react'
|
||||
import { useId, useRef, useState, type CSSProperties, type KeyboardEvent } from 'react'
|
||||
|
||||
import HomeLink, { isExternal } from './HomeLink.tsx'
|
||||
import type { FrontPagePath } from '../../../lib/useFrontPage.ts'
|
||||
import { ACCENTS, withAlpha, accentText, readableOn } from '../../../lib/color.ts'
|
||||
import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts'
|
||||
|
||||
type PathfinderProps = {
|
||||
id: string
|
||||
|
|
@ -90,21 +96,25 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
|||
focus(moves[e.key])
|
||||
}
|
||||
|
||||
// A cell's rules: right and bottom, the outer ones clipped off
|
||||
// by the wrapper (the grid runs 2px past it).
|
||||
const cell = 'border-r-2 border-b-2 border-brand'
|
||||
const panelFill = `color-mix(in srgb, ${accent} 12%, var(--color-surface))`
|
||||
|
||||
return (
|
||||
<section id={id} className="py-24">
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
<div className="grid gap-12 lg:grid-cols-12">
|
||||
<div className="lg:col-span-5">
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
|
||||
{title}
|
||||
</h2>
|
||||
{blurb && <p className="mt-4 text-lg text-muted">{blurb}</p>}
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">{title}</h2>
|
||||
{blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>}
|
||||
|
||||
<div className="mt-12 overflow-hidden">
|
||||
<div className="-mr-[2px] -mb-[2px]">
|
||||
<div
|
||||
role="tablist"
|
||||
aria-label={title}
|
||||
aria-orientation="vertical"
|
||||
className="mt-10 flex flex-col gap-3"
|
||||
aria-orientation="horizontal"
|
||||
className="grid sm:grid-cols-2 lg:grid-cols-[repeat(var(--paths),minmax(0,1fr))]"
|
||||
style={{ '--paths': Math.min(paths.length, 5) } as CSSProperties}
|
||||
onKeyDown={onKeyDown}
|
||||
>
|
||||
{paths.map((option, index) => {
|
||||
|
|
@ -123,84 +133,65 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
|||
aria-controls={`${base}-panel`}
|
||||
tabIndex={on ? 0 : -1}
|
||||
onClick={() => setSelected(index)}
|
||||
className="group flex items-center gap-4 border-2 px-5 py-4 text-left transition-all duration-300"
|
||||
style={{
|
||||
borderColor: on ? color : 'rgba(19,139,160,0.12)',
|
||||
background: on ? `${withAlpha(color, 7)}` : 'var(--color-surface)',
|
||||
transform: on ? 'translateX(8px)' : undefined,
|
||||
}}
|
||||
className={`${cell} flex items-center gap-4 px-6 py-6 text-left transition-colors duration-300 ${
|
||||
on ? '' : 'bg-surface hover:bg-tint-soft'
|
||||
}`}
|
||||
style={on ? { background: color, color: readableOn(color) } : undefined}
|
||||
>
|
||||
<span
|
||||
className="flex h-12 w-12 shrink-0 items-center justify-center text-2xl transition-transform duration-300 group-hover:scale-110"
|
||||
style={{
|
||||
background: on ? color : `${withAlpha(color, 12)}`,
|
||||
color: on ? readableOn(color) : accentText(color),
|
||||
}}
|
||||
className="text-2xl"
|
||||
style={{ color: on ? readableOn(color) : accentText(color) }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<PathIcon value={option.icon} />
|
||||
</span>
|
||||
<span className="font-display text-xl font-bold" style={{ color: on ? accentText(color) : 'var(--color-ink)' }}>
|
||||
<span className="font-display text-xl font-bold" style={on ? undefined : { color: 'var(--color-ink)' }}>
|
||||
{option.label}
|
||||
</span>
|
||||
<span
|
||||
className="ml-auto text-xl transition-opacity"
|
||||
style={{ color, opacity: on ? 1 : 0 }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />
|
||||
</span>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
key={selected}
|
||||
id={`${base}-panel`}
|
||||
role="tabpanel"
|
||||
aria-labelledby={`${base}-tab-${selected}`}
|
||||
className="relative overflow-hidden p-8 md:p-10 lg:col-span-7"
|
||||
style={{ background: withAlpha(accent, 5) }}
|
||||
>
|
||||
<div
|
||||
key={selected}
|
||||
id={`${base}-panel`}
|
||||
role="tabpanel"
|
||||
aria-labelledby={`${base}-tab-${selected}`}
|
||||
className="grid sm:grid-cols-2 lg:grid-cols-3"
|
||||
>
|
||||
{path.blurb && (
|
||||
<p
|
||||
className={`${cell} hp-pop p-8 font-display text-2xl leading-snug text-ink md:p-10`}
|
||||
style={{ background: panelFill }}
|
||||
>
|
||||
{path.blurb}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{path.blurb && (
|
||||
<p className="hp-pop relative max-w-md font-display text-2xl font-semibold leading-snug text-ink">
|
||||
{path.blurb}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<ul className="relative mt-8 grid gap-4 sm:grid-cols-2">
|
||||
{path.actions.map((action, index) => (
|
||||
<li
|
||||
<HomeLink
|
||||
key={`${action.url}-${index}`}
|
||||
className="hp-pop"
|
||||
url={action.url}
|
||||
className={`${cell} hp-pop group flex flex-col bg-surface p-8 transition-colors duration-200 hover:bg-tint-soft`}
|
||||
style={{ animationDelay: `${120 + index * 90}ms` }}
|
||||
>
|
||||
<HomeLink
|
||||
url={action.url}
|
||||
className="group flex h-full flex-col bg-surface p-6 shadow-sm ring-1 ring-black/5 transition-all duration-300 hover:-translate-y-1 hover:shadow-xl"
|
||||
>
|
||||
<span className="flex items-start gap-2 font-display text-lg font-bold text-ink">
|
||||
{action.label}
|
||||
<span
|
||||
className="ml-auto transition-transform group-hover:translate-x-1"
|
||||
style={{ color: accentText(accent) }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{isExternal(action.url) ? <ArrowUpRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" /> : <ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />}
|
||||
</span>
|
||||
<span className="flex items-start gap-2 font-display text-lg font-bold text-ink">
|
||||
{action.label}
|
||||
<span
|
||||
className="ml-auto transition-transform group-hover:translate-x-1"
|
||||
style={{ color: accentText(accent) }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{isExternal(action.url) ? <ArrowUpRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" /> : <ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />}
|
||||
</span>
|
||||
{action.description && (
|
||||
<span className="mt-2 text-sm leading-relaxed text-muted">
|
||||
{action.description}
|
||||
</span>
|
||||
)}
|
||||
</HomeLink>
|
||||
</li>
|
||||
</span>
|
||||
{action.description && (
|
||||
<span className="mt-2 text-sm leading-relaxed text-muted">{action.description}</span>
|
||||
)}
|
||||
</HomeLink>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue