advent22/ui/src/components/bulma/Breadcrumbs.vue

40 lines
883 B
Vue
Raw Normal View History

<!-- eslint-disable vue/multi-word-component-names -->
2023-01-31 22:31:27 +00:00
<template>
<nav class="breadcrumb has-succeeds-separator">
<ul>
2023-09-07 01:17:14 +00:00
<li
v-for="(step, index) in steps"
:key="index"
2023-09-07 01:17:14 +00:00
:class="modelValue === index ? 'is-active' : ''"
2023-09-07 02:12:17 +00:00
@click.left="change_step(index)"
2023-09-07 01:17:14 +00:00
>
2023-01-31 22:31:27 +00:00
<a>
<span class="icon is-small">
<FontAwesomeIcon :icon="step.icon" />
2023-01-31 22:31:27 +00:00
</span>
<span>{{ step.label }}</span>
</a>
</li>
</ul>
</nav>
</template>
<script setup lang="ts">
import { Step } from "@/lib/helpers";
2023-01-31 22:31:27 +00:00
const props = defineProps<{
steps: Step[];
modelValue: number;
}>();
2023-01-31 22:31:27 +00:00
const emit = defineEmits<{
(event: "update:modelValue", value: number): void;
}>();
2023-01-31 22:31:27 +00:00
function change_step(next_step: number) {
if (next_step === props.modelValue) return;
2023-01-31 22:31:27 +00:00
emit("update:modelValue", next_step);
2023-01-31 22:31:27 +00:00
}
2023-09-07 01:17:14 +00:00
</script>