index.pug 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. div(class="page-view")
  2. //- Состояние загрузки
  3. div(v-if="loading" class="container mx-auto px-4 py-8")
  4. div(class="flex justify-center items-center py-12")
  5. div(class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600")
  6. //- Состояние ошибки
  7. div(v-else-if="error" class="container mx-auto px-4 py-8")
  8. div(class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded")
  9. p {{ error }}
  10. app-link(to="/" class="text-blue-600 hover:text-blue-800 mt-2 inline-block") Вернуться на главную
  11. //- Контент страницы
  12. div(v-else-if="page" class="page-content")
  13. //- Хидер страницы
  14. header(class="bg-white dark:bg-gray-800 shadow-sm")
  15. div(class="container mx-auto px-4 py-6")
  16. div(class="flex items-center justify-between")
  17. div
  18. h1(class="text-3xl font-bold text-gray-800 dark:text-white") {{ getText(page.title) }}
  19. p(v-if="page.excerpt" class="text-gray-600 dark:text-gray-300 mt-2") {{ getText(page.excerpt) }}
  20. div(class="flex items-center space-x-4")
  21. span(class="text-sm text-gray-500") {{ formatDate(page.created_at) }}
  22. //- Основной контент
  23. main(class="container mx-auto px-4 py-8")
  24. div(v-if="page.image" class="mb-8")
  25. img(
  26. :src="getText(page.image)"
  27. :alt="getText(page.title)"
  28. class="w-full h-64 object-cover rounded-lg shadow-md"
  29. )
  30. //- Динамический контент с компонентами
  31. div(
  32. class="prose prose-lg max-w-none dark:prose-invert"
  33. v-html="processedContent"
  34. )
  35. //- Дополнительная информация
  36. footer(v-if="page.tags || page.author" class="border-t border-gray-200 dark:border-gray-700 mt-8 pt-8")
  37. div(class="container mx-auto px-4")
  38. div(class="flex flex-wrap gap-4 items-center justify-between")
  39. div(v-if="page.tags" class="flex flex-wrap gap-2")
  40. span(
  41. v-for="tag in getText(page.tags)"
  42. :key="tag"
  43. class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded"
  44. ) {{ tag }}
  45. div(v-if="page.author" class="text-sm text-gray-500")
  46. | Автор: {{ getText(page.author) }}
  47. //- Страница не найдена
  48. div(v-else class="container mx-auto px-4 py-8")
  49. div(class="text-center")
  50. h2(class="text-2xl font-bold text-gray-800 dark:text-white mb-4") Страница не найдена
  51. p(class="text-gray-600 dark:text-gray-300 mb-6") Запрошенная страница не существует или была перемещена
  52. app-link(
  53. to="/"
  54. class="bg-blue-600 text-white px-6 py-3 rounded-lg hover:bg-blue-700 transition-colors"
  55. ) Вернуться на главную