workbench-todo.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <script setup lang="ts">
  2. import type { WorkbenchTodoItem } from '../typing';
  3. import {
  4. Card,
  5. CardContent,
  6. CardHeader,
  7. CardTitle,
  8. VbenCheckbox,
  9. } from '@vben-core/shadcn-ui';
  10. interface Props {
  11. items?: WorkbenchTodoItem[];
  12. title: string;
  13. }
  14. defineOptions({
  15. name: 'WorkbenchTodo',
  16. });
  17. withDefaults(defineProps<Props>(), {
  18. items: () => [],
  19. });
  20. </script>
  21. <template>
  22. <Card>
  23. <CardHeader class="py-4">
  24. <CardTitle class="text-lg">{{ title }}</CardTitle>
  25. </CardHeader>
  26. <CardContent class="flex flex-wrap p-5 pt-0">
  27. <ul class="divide-border w-full divide-y" role="list">
  28. <li
  29. v-for="item in items"
  30. :key="item.title"
  31. :class="{
  32. 'select-none line-through opacity-60': item.completed,
  33. }"
  34. class="flex cursor-pointer justify-between gap-x-6 py-5"
  35. >
  36. <div class="flex min-w-0 items-center gap-x-4">
  37. <VbenCheckbox v-model:checked="item.completed" name="completed" />
  38. <div class="min-w-0 flex-auto">
  39. <p class="text-foreground text-sm font-semibold leading-6">
  40. {{ item.title }}
  41. </p>
  42. <!-- eslint-disable vue/no-v-html -->
  43. <p
  44. class="text-foreground/80 *:text-primary mt-1 truncate text-xs leading-5"
  45. v-html="item.content"
  46. ></p>
  47. </div>
  48. </div>
  49. <div class="hidden h-full shrink-0 sm:flex sm:flex-col sm:items-end">
  50. <span class="text-foreground/80 mt-6 text-xs leading-6">
  51. {{ item.date }}
  52. </span>
  53. </div>
  54. </li>
  55. </ul>
  56. </CardContent>
  57. </Card>
  58. </template>