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

	export let mode: UpdateMode;

	function select(e: string) {
		mode = e as UpdateMode;
	}
</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 btn-xs hover:bg-slate-700 [&.active.dangerous]:bg-rose-800 [&.active]:bg-indigo-700"
			on:click={() => select(e)}
		>
			{label}
		</button>
	{/each}
</div>
