CharacterToolbar.vue 1.3 KB

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