CharacterToolbar.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <Toolbar :pt="{ root: 'min-h-11.5 rounded-b-none' }">
  3. <template #start>
  4. <div class="ps-6 text-sm whitespace-nowrap text-primary">
  5. Showing
  6. <strong class="font-semibold">{{ filteredCountText }}</strong> of
  7. <strong class="font-semibold">{{ count }}</strong>
  8. {{ pluralize("character", count) }}
  9. </div>
  10. </template>
  11. <template #end>
  12. <Button
  13. v-if="isSignedIn"
  14. class="border-none px-6! py-3.25"
  15. variant="text"
  16. >
  17. <NuxtLink
  18. class="flex items-center gap-0.5"
  19. :to="{ name: 'characterCreate' }"
  20. >
  21. <span class="font-semibold">Add</span>
  22. <Icon name="ph:plus-bold" />
  23. </NuxtLink>
  24. </Button>
  25. </template>
  26. </Toolbar>
  27. </template>
  28. <script setup>
  29. const props = defineProps({
  30. count: {
  31. type: Number,
  32. required: true
  33. },
  34. filteredCount: {
  35. type: Number,
  36. required: true
  37. }
  38. })
  39. const { isSignedIn } = useAuthClient()
  40. const filteredCountText = computed(() => {
  41. switch (props.filteredCount) {
  42. case props.count:
  43. return "all"
  44. case 0:
  45. return "none"
  46. default:
  47. return props.filteredCount
  48. }
  49. })
  50. </script>
  51. <style scoped></style>