diff --git a/docs/agent/skills/ipal-block/resources/kod-sekcji.md b/docs/agent/skills/ipal-block/resources/kod-sekcji.md index 560bfbf..4f8bc93 100644 --- a/docs/agent/skills/ipal-block/resources/kod-sekcji.md +++ b/docs/agent/skills/ipal-block/resources/kod-sekcji.md @@ -137,40 +137,40 @@ export function buttonClass(appearance: LinkAppearance): string { } ``` -`src/components/ui/Media.tsx` — **każdy** obraz/wideo z panelu: +`src/components/ui/Media.tsx` — **każdy** obraz/wideo z panelu. Szybkość liczy plugin +(`mediaImageProps`, `videoProps`), wygląd zostaje tutaj: ```tsx import Image from 'next/image' +import { mediaImageProps, MEDIA_SIZES, videoProps, type VideoMode } from '@intecion/ipal-kit' import type { Media as MediaDoc } from '@/payload-types' type Props = { resource: MediaDoc | string | number | null | undefined + /** Szerokość NA EKRANIE — MEDIA_SIZES.half / .third / własny string. Bez tego pobiera się pełna szerokość. */ sizes?: string + /** Tylko pierwszy widoczny obraz strony (hero, LCP). Reszta ładuje się leniwie. */ priority?: boolean className?: string - /** Poster image URL for videos (shown before playback). */ - poster?: string + /** Wideo: 'background' (pętla bez dźwięku) albo 'player' (kontrolki, ładowanie po kliknięciu). */ + videoMode?: VideoMode + /** Plakat wideo — upload z panelu. */ + poster?: MediaDoc | string | number | null } -export function Media({ resource, sizes = '100vw', priority = false, className, poster }: Props) { - if (!resource || typeof resource !== 'object' || !resource.url) return null - const { url, alt, width, height, mimeType } = resource - - if (mimeType?.startsWith('video/')) { - // preload="metadata": the browser fetches only headers until playback, not the whole file - return ( -