Lib: Add imgwidth/imgheight to Card component so layout doesn't jump when lazyloading images

This commit is contained in:
2024-12-16 02:28:31 +01:00
parent fde45eb37c
commit 262ac50356
5 changed files with 33 additions and 10 deletions

View File

@ -6,6 +6,7 @@
import type { Race } from "$lib/schema";
import Input from "./Input.svelte";
import { format } from "date-fns";
import { RACE_PICTOGRAM_HEIGHT, RACE_PICTOGRAM_WIDTH } from "$lib/config";
interface RaceCardProps {
/** The [Race] object used to prefill values. */
@ -56,6 +57,8 @@
<Card
imgsrc={race?.pictogram_url ?? pictogram_template}
imgwidth={RACE_PICTOGRAM_WIDTH}
imgheight={RACE_PICTOGRAM_HEIGHT}
imgid="update_race_pictogram_preview_{race?.id ?? 'create'}"
>
<form method="POST" enctype="multipart/form-data">