Overhaul fixes: raised cards, balanced people rows, solid map, small button radius
- Cards sit on a raised surface (white, or a touch of tint in dark mode) with a shadow: featured cards, the connect block, people tiles. tint-soft is a faint teal again, not green. - Buttons: a small plain radius everywhere; no superellipse. - Video stills use YouTube's 16:9 frame (the 4:3 one cropped as a fallback), have small rounded corners, and show a round, centered play button on hover or focus (always on touch screens). - People tiles: rows balanced between 2 and 10 across, never ending on a lone tile where it can be helped. - Map tiles and region tags are solid, dimmed by color, not opacity. - Admin: white (surface) background, header and footer as wide as the content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
582c65077d
commit
a397f3eac0
12 changed files with 165 additions and 61 deletions
|
|
@ -5,14 +5,17 @@
|
|||
page loads no iframes until someone asks for one. Used by the
|
||||
featured cards and the video content block.
|
||||
|
||||
The still is the caller's image, else YouTube's own thumbnail,
|
||||
else a plain dark panel. A link that embeds.ts can't turn into a
|
||||
The still is the caller's image, else YouTube's own thumbnail
|
||||
(its 16:9 one, falling back to the 4:3 one cropped), else a plain
|
||||
dark panel. The play button shows on hover or keyboard focus, and
|
||||
always on a touch screen, which can't hover. Small rounded
|
||||
corners, as the only rounded thing besides buttons and dots. A link that embeds.ts can't turn into a
|
||||
player (not https, or not a host it knows how to frame) still
|
||||
goes somewhere: the still becomes a link to it.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { Play } from '@phosphor-icons/react'
|
||||
import { useState } from 'react'
|
||||
import { useState, type SyntheticEvent } from 'react'
|
||||
|
||||
import HomeLink from '../pages/sections/home/HomeLink.tsx'
|
||||
import { playingSource, videoSource, videoThumbnail } from '../lib/embeds.ts'
|
||||
|
|
@ -37,36 +40,42 @@ export default function VideoPlayer({
|
|||
if (playing && source) {
|
||||
const live = playingSource(source)
|
||||
return live.kind === 'file' ? (
|
||||
<video src={live.src} controls autoPlay playsInline className={`aspect-video w-full bg-black ${className}`} />
|
||||
<video src={live.src} controls autoPlay playsInline className={`aspect-video w-full rounded-md bg-black ${className}`} />
|
||||
) : (
|
||||
<iframe
|
||||
src={live.src}
|
||||
title={title || 'Video'}
|
||||
allow="autoplay; encrypted-media; picture-in-picture; fullscreen"
|
||||
allowFullScreen
|
||||
className={`aspect-video w-full border-0 bg-black ${className}`}
|
||||
className={`aspect-video w-full rounded-md border-0 bg-black ${className}`}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const image = still ?? videoThumbnail(url)
|
||||
|
||||
// YouTube's 16:9 still is missing for some videos; its 4:3 one never is.
|
||||
const fallBack = (event: SyntheticEvent<HTMLImageElement>) => {
|
||||
const img = event.currentTarget
|
||||
if (img.src.endsWith('/hq720.jpg')) img.src = img.src.replace(/hq720\.jpg$/, 'hqdefault.jpg')
|
||||
}
|
||||
|
||||
const face = (
|
||||
<>
|
||||
<span className={`relative block overflow-hidden rounded-md ${className}`}>
|
||||
{image ? (
|
||||
<img src={image} alt="" loading="lazy" className={`aspect-video w-full object-cover ${className}`} />
|
||||
<img src={image} alt="" loading="lazy" onError={fallBack} className="block aspect-video w-full object-cover" />
|
||||
) : (
|
||||
<div className={`aspect-video w-full bg-[#004552] ${className}`} />
|
||||
<span className="block aspect-video w-full bg-[#004552]" />
|
||||
)}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="absolute inset-0 flex items-center justify-center bg-black/10 transition-colors group-hover:bg-black/25"
|
||||
className="video-play absolute inset-0 flex items-center justify-center transition-colors group-hover:bg-black/20 group-focus-visible:bg-black/20"
|
||||
>
|
||||
<span className="flex h-16 w-16 items-center justify-center btn bg-white/90 shadow-lg transition-transform group-hover:scale-110">
|
||||
<Play className="ml-1 h-7 w-7" weight="fill" style={{ color: BRAND }} aria-hidden="true" />
|
||||
<span className="flex h-16 w-16 items-center justify-center rounded-full bg-white/95 shadow-lg transition-transform group-hover:scale-105">
|
||||
<Play className="h-7 w-7" weight="fill" style={{ color: BRAND }} aria-hidden="true" />
|
||||
</span>
|
||||
</span>
|
||||
</>
|
||||
</span>
|
||||
)
|
||||
|
||||
if (!source) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue