The frontend component of PuffPastry, meant to interface with the backend, which in turn interfaces with the smart contract.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

WizardStepper.vue 1.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <ol class="flex flex-wrap items-center gap-y-2">
  3. <li
  4. v-for="(step, index) in steps"
  5. :key="step.id"
  6. class="flex items-center"
  7. >
  8. <button
  9. type="button"
  10. class="flex items-center gap-2 rounded-lg px-1.5 py-1 transition"
  11. :class="stepClasses(index)"
  12. :disabled="index > maxVisited"
  13. @click="emit('goTo', index)"
  14. >
  15. <span
  16. class="flex h-6 w-6 items-center justify-center rounded-full text-xs font-semibold"
  17. :class="badgeClasses(index)"
  18. >
  19. {{ index + 1 }}
  20. </span>
  21. <span class="hidden text-sm font-medium sm:inline">{{ step.label }}</span>
  22. </button>
  23. <span v-if="index < steps.length - 1" class="mx-1 h-px w-4 bg-slate-300 sm:w-6" aria-hidden="true" />
  24. </li>
  25. </ol>
  26. </template>
  27. <script setup lang="ts">
  28. import type { WizardStep } from "../../composables/useProposalWizard";
  29. const props = defineProps<{
  30. steps: WizardStep[];
  31. current: number;
  32. maxVisited: number;
  33. }>();
  34. const emit = defineEmits<{
  35. goTo: [index: number];
  36. }>();
  37. const stepClasses = (index: number) => {
  38. if (index === props.current) return "text-slate-900";
  39. if (index <= props.maxVisited) return "text-slate-600 hover:bg-slate-100 cursor-pointer";
  40. return "text-slate-400 cursor-not-allowed";
  41. };
  42. const badgeClasses = (index: number) => {
  43. if (index === props.current) return "bg-amber-500 text-white";
  44. if (index < props.current) return "bg-slate-700 text-white";
  45. return "bg-slate-200 text-slate-500";
  46. };
  47. </script>