Data/Season: Add "active" switches on drivers page

This commit is contained in:
2024-12-15 21:44:27 +01:00
parent 4003cb5645
commit 2989e8a2ed
3 changed files with 24 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { get_image_preview_event_handler } from "$lib/image";
import { FileDropzone } from "@skeletonlabs/skeleton";
import { FileDropzone, SlideToggle } from "@skeletonlabs/skeleton";
import Card from "./Card.svelte";
import Button from "./Button.svelte";
import type { Driver } from "$lib/schema";
@ -20,13 +20,14 @@
/** The [src] of the driver headshot template preview */
headshot_template?: 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[];
/** The value this component's active switch will bind to */
active_value: boolean;
}
let {
@ -36,6 +37,7 @@
headshot_template = "",
team_select_value,
team_select_options,
active_value,
}: DriverCardProps = $props();
</script>
@ -103,7 +105,15 @@
</FileDropzone>
<!-- Save/Delete buttons -->
<div class="flex justify-end gap-2">
<div class="flex items-center justify-end gap-2">
<div class="mr-auto">
<SlideToggle
name="active"
background="bg-primary-500"
active="bg-tertiary-500"
bind:checked={active_value}
/>
</div>
{#if driver}
<Button formaction="?/update_driver" color="secondary" disabled={disable_inputs} submit
>Save Changes</Button