summaryrefslogblamecommitdiffstatshomepage
path: root/frontend/src/lib/dialogs/components/UpdateModeSelector.svelte
blob: e4b4479f5d9ca477b616661272a9c080da1b350f (plain) (tree)























                                                                                                                       
<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>