feat(website): photos upright, without metadata, in responsive sizes
Every upload is turned upright, stripped of its metadata (EXIF, GPS), kept at most 2400 px wide and saved at 480/960/1600 px in WebP and JPEG; the pages pick the size with <picture> and srcset. Every file counts towards storage; a photo that can't be read is refused. sharp 0.35 (prebuilt, no build step on the servers). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* photo.
|
||||
*/
|
||||
import { media } from "../load";
|
||||
import { Button, cx, Img, type ButtonData } from "../parts";
|
||||
import { Button, cx, Img, Picture, type ButtonData } from "../parts";
|
||||
import type { Image, SectionProps } from "../types";
|
||||
|
||||
type HeroData = { headline: string; subline: string | null; images: string[]; videoId: string | null; button: ButtonData };
|
||||
@@ -24,7 +24,7 @@ function Words({ d, centred, light, size = "cc-h1" }: { d: HeroData; centred?: b
|
||||
function Video({ video, still, className }: { video: Image | null; still: Image | null; className?: string }) {
|
||||
return (
|
||||
<div className={cx("relative h-full w-full", className)}>
|
||||
{still ? <img src={still.url} alt={still.alt} className="cc-img absolute inset-0" fetchPriority="high" /> : <div className="absolute inset-0 bg-brand" />}
|
||||
{still ? <Picture image={still} priority className="cc-img absolute inset-0" /> : <div className="absolute inset-0 bg-brand" />}
|
||||
{video && (
|
||||
<video className="cc-motion cc-img absolute inset-0 hidden sm:block" src={video.url} poster={still?.url} autoPlay muted loop playsInline aria-hidden="true" />
|
||||
)}
|
||||
@@ -79,7 +79,7 @@ export function Hero({ section, site, template }: SectionProps) {
|
||||
if (template === "bold") {
|
||||
return (
|
||||
<section className="cc-section-hero grid bg-gray-950 text-white md:min-h-[80vh] md:grid-cols-2">
|
||||
<div className="relative min-h-[50vh] md:order-2">{first && <img src={first.url} alt={first.alt} className="cc-img absolute inset-0" fetchPriority="high" />}</div>
|
||||
<div className="relative min-h-[50vh] md:order-2">{first && <Picture image={first} sizes="(min-width: 768px) 50vw, 100vw" priority className="cc-img absolute inset-0" />}</div>
|
||||
<div className="flex flex-col justify-center px-6 pb-16 pt-32 sm:px-12"><Words d={d} light /></div>
|
||||
</section>
|
||||
);
|
||||
@@ -100,7 +100,7 @@ export function Hero({ section, site, template }: SectionProps) {
|
||||
return (
|
||||
<Fullbleed d={d} site={site}>
|
||||
<div className="grid h-full grid-cols-3 gap-1">
|
||||
{three.map((im, i) => <div key={i} className="relative">{im ? <img src={im.url} alt={im.alt} className="cc-img absolute inset-0" /> : <div className="absolute inset-0 bg-brand/60" />}</div>)}
|
||||
{three.map((im, i) => <div key={i} className="relative">{im ? <Picture image={im} sizes="34vw" priority={i === 0} className="cc-img absolute inset-0" /> : <div className="absolute inset-0 bg-brand/60" />}</div>)}
|
||||
</div>
|
||||
</Fullbleed>
|
||||
);
|
||||
@@ -134,7 +134,7 @@ export function Hero({ section, site, template }: SectionProps) {
|
||||
}
|
||||
|
||||
// photo (and video, drawn the same way with its loop).
|
||||
const visual = variant === "video" ? <Video video={video} still={first} /> : first ? <img src={first.url} alt={first.alt} className="cc-img absolute inset-0" fetchPriority="high" /> : null;
|
||||
const visual = variant === "video" ? <Video video={video} still={first} /> : first ? <Picture image={first} priority className="cc-img absolute inset-0" /> : null;
|
||||
if (template === "bold") return <Fullbleed d={d} site={site}>{visual ?? <div className="h-full w-full bg-brand" />}</Fullbleed>;
|
||||
if (template === "heritage") {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user