Present: a slide with more than the screen holds scrolls through it
The day overview, tag and block lists and the spotlight text hold, scroll to the end over the slide's seconds, then hold. The spotlight description is no longer cut at six lines. Reduced motion keeps them at the top. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b30f5f11fe
commit
d17e2596ba
2 changed files with 111 additions and 53 deletions
|
|
@ -38,3 +38,25 @@
|
|||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* A slide part taller than its room (Scroll): holds at the top,
|
||||
moves up by --present-scroll, holds at the end. With reduced
|
||||
motion it stays at the top. */
|
||||
.present-scroll {
|
||||
animation: present-scroll ease-in-out both;
|
||||
}
|
||||
@keyframes present-scroll {
|
||||
0%,
|
||||
15% {
|
||||
transform: none;
|
||||
}
|
||||
85%,
|
||||
100% {
|
||||
transform: translateY(var(--present-scroll));
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.present-scroll {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
tag after the days: each of the schedule's tags (087)
|
||||
and everything it's on, under each day's name
|
||||
A heading (086) is only a line on the overview; a break gets no
|
||||
spotlight. "Only entries tagged" (`only=<key>`) cuts every slide
|
||||
spotlight. A slide with more than the screen holds scrolls through
|
||||
it over its seconds. "Only entries tagged" (`only=<key>`) cuts every slide
|
||||
to what one tag is on, eg. for a screen outside the youth room.
|
||||
|
||||
Keys while playing: arrows step, Space pauses, Escape leaves full
|
||||
|
|
@ -29,7 +30,7 @@
|
|||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowsOut, CaretLeft, CaretRight, Gear, Pause, Play } from '@phosphor-icons/react'
|
||||
import { useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||
import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react'
|
||||
import { useParams, useSearchParams } from 'react-router-dom'
|
||||
|
||||
import PageState from '../components/PageState.tsx'
|
||||
|
|
@ -584,6 +585,35 @@ function Rise({ order = 0, from = 'below', className = '', children }: {
|
|||
)
|
||||
}
|
||||
|
||||
/* A slide's part that may not fit: when its content is taller than
|
||||
the room it has, it holds, scrolls to the end over the slide's
|
||||
`seconds`, then holds again. `center` puts short content in the
|
||||
middle (and still starts long content at the top). */
|
||||
function Scroll({ seconds, center = false, className = '', children }: {
|
||||
seconds: number
|
||||
center?: boolean
|
||||
className?: string
|
||||
children: ReactNode
|
||||
}) {
|
||||
const box = useRef<HTMLDivElement>(null)
|
||||
const [by, setBy] = useState(0)
|
||||
useLayoutEffect(() => {
|
||||
const outer = box.current
|
||||
const inner = outer?.firstElementChild as HTMLElement | null
|
||||
if (outer && inner) setBy(Math.max(0, inner.offsetHeight - outer.clientHeight))
|
||||
}, [])
|
||||
return (
|
||||
<div ref={box} className={`min-h-0 flex-1 overflow-hidden ${center ? 'flex flex-col' : ''} ${className}`}>
|
||||
<div
|
||||
className={`${center ? 'my-auto' : ''} ${by ? 'present-scroll' : ''}`}
|
||||
style={by ? ({ '--present-scroll': `-${by}px`, animationDuration: `${seconds}s` } as CSSProperties) : undefined}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/* An overview's rows: each entry, a block's sub-items under it.
|
||||
`start` is the first row's place in the slide's entrance. */
|
||||
function OverviewEntries({ entries, accent, start = 1 }: { entries: ContentBlockItem[]; accent: string; start?: number }) {
|
||||
|
|
@ -673,9 +703,11 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
{slide.day.name || 'Schedule'}
|
||||
</h1>
|
||||
</Rise>
|
||||
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||
<Scroll seconds={slide.seconds}>
|
||||
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||
<OverviewEntries entries={entries} accent={accent} />
|
||||
</ul>
|
||||
</Scroll>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -693,7 +725,8 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
{tag.name}
|
||||
</h1>
|
||||
</Rise>
|
||||
<ul className={`grid min-h-0 flex-1 content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||
<Scroll seconds={slide.seconds}>
|
||||
<ul className={`grid content-start gap-x-[4vw] ${two ? 'grid-cols-2' : 'grid-cols-1'}`}>
|
||||
{tagDays.map((day, d) => {
|
||||
const start = order
|
||||
order += day.entries.length + 1
|
||||
|
|
@ -711,6 +744,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
)
|
||||
})}
|
||||
</ul>
|
||||
</Scroll>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -745,7 +779,8 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
</p>
|
||||
</Rise>
|
||||
)}
|
||||
<ul className="mt-[4vh] min-h-0 flex-1" style={{ borderLeft: `0.4vw solid ${withAlpha(accent, 40)}` }}>
|
||||
<Scroll seconds={slide.seconds} className="mt-[4vh]">
|
||||
<ul style={{ borderLeft: `0.4vw solid ${withAlpha(accent, 40)}` }}>
|
||||
{items.map((item, i) => (
|
||||
<li key={i} className="even:bg-tint-soft/60" style={item.featured ? featuredStyle(accent) : undefined}>
|
||||
<Rise order={i + 3} from="left" className="flex items-center gap-[2vw] px-[2vw] py-[1.6vh]">
|
||||
|
|
@ -777,6 +812,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Scroll>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -814,7 +850,7 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
)}
|
||||
</Rise>
|
||||
)}
|
||||
<div className="min-w-0 flex-1">
|
||||
<Scroll seconds={slide.seconds} center className="min-w-0 self-stretch">
|
||||
<Rise from="right">
|
||||
<p className="text-[clamp(1.2rem,2.4vw,3rem)] font-semibold" style={{ color }}>
|
||||
{[slide.day.name, slide.parent?.text, entry.time].filter(Boolean).join(' · ')}
|
||||
|
|
@ -849,12 +885,12 @@ function SlideView({ slide, accent }: { slide: Slide; accent: string }) {
|
|||
)}
|
||||
{entry.description && (
|
||||
<Rise order={4} from="right">
|
||||
<div className="mt-[3vh] line-clamp-6 space-y-3 text-[clamp(1rem,1.8vw,2.2rem)] leading-snug text-muted">
|
||||
<div className="mt-[3vh] space-y-3 text-[clamp(1rem,1.8vw,2.2rem)] leading-snug text-muted">
|
||||
<Paragraphs text={entry.description} accent={accent} />
|
||||
</div>
|
||||
</Rise>
|
||||
)}
|
||||
</div>
|
||||
</Scroll>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue