<script lang="ts">
	import { UpdateMode } from '$gql/graphql';
	import { UpdateModeLabel } from '$lib/Enums';

	let { mode = $bindable() }: { mode: UpdateMode } = $props();
</script>

<div class="flex gap-1 pb-1 text-xs">
	{#each Object.entries(UpdateModeLabel) as [e, label]}
		<button
			type="button"
			class:active={mode === e}
			class:dangerous={mode !== UpdateMode.Add}
			class="btn-xs hover:bg-slate-700 [&.active]:bg-indigo-700 [&.active.dangerous]:bg-rose-800"
			onclick={() => (mode = e as UpdateMode)}
		>
			{label}
		</button>
	{/each}
</div>
