Lib: Only pass single "team_select_value" into component except of all of them

This commit is contained in:
2024-12-15 20:56:49 +01:00
parent 72abc891e5
commit 7648886ca4

View File

@ -17,11 +17,15 @@
/** Require all inputs if [true] */ /** Require all inputs if [true] */
require_inputs?: boolean; require_inputs?: boolean;
/** The [src] of the team logo template preview */ /** The [src] of the driver headshot template preview */
logo_template?: string; headshot_template?: string;
team_select_values: { [key: string]: string }; // TODO: Move into this component?
/** The value this component's team select dropdown will bind to */
team_select_value: string;
/** The options this component's team select dropdown will display */
team_select_options: DropdownOption[]; team_select_options: DropdownOption[];
} }
@ -29,14 +33,14 @@
driver = undefined, driver = undefined,
disable_inputs = false, disable_inputs = false,
require_inputs = false, require_inputs = false,
logo_template = "", headshot_template = "",
team_select_values, team_select_value,
team_select_options, team_select_options,
}: DriverCardProps = $props(); }: DriverCardProps = $props();
</script> </script>
<Card <Card
imgsrc={driver?.headshot_url ?? logo_template} imgsrc={driver?.headshot_url ?? headshot_template}
imgid="update_driver_headshot_preview_{driver?.id ?? 'create'}" imgid="update_driver_headshot_preview_{driver?.id ?? 'create'}"
> >
<form method="POST" enctype="multipart/form-data"> <form method="POST" enctype="multipart/form-data">
@ -78,7 +82,7 @@
<!-- Driver team input --> <!-- Driver team input -->
<Dropdown <Dropdown
name="team" name="team"
input_variable={team_select_values[driver?.id ?? "create"]} input_variable={team_select_value}
options={team_select_options} options={team_select_options}
labelwidth="120px" labelwidth="120px"
disabled={disable_inputs} disabled={disable_inputs}