SPB Git

Repository Public

Photo.tsx 920 B 15 lines tsx

1import Image from "next/image";2import type { Photo as PhotoT } from "@/lib/schemas";3import type { Locale } from "@/lib/i18n";45/** Real photograph, served through next/image (AVIF/WebP, responsive sizes, blur placeholder, no layout shift). */6export function Photo({ photo, locale, sizes, priority = false, className = "", fill = false, focus, quality = 75 }: { photo: PhotoT; locale: Locale; sizes: string; priority?: boolean; className?: string; fill?: boolean; focus?: string; quality?: 60 | 75 }) {7  const alt = photo.alt[locale];8  const common = { src: photo.file, sizes, priority, placeholder: "blur" as const, blurDataURL: photo.blur, quality };9  return fill ? (10    <Image {...common} alt={alt} fill className={`object-cover ${className}`} style={{ objectPosition: focus ?? photo.focus }} />11  ) : (12    <Image {...common} alt={alt} width={photo.width} height={photo.height} className={className} />13  );14}15
Files main
Menu

Theme